// To parse this JSON data, do // // final nih = nihFromJson(jsonString); import 'dart:convert'; List nihFromJson(String str) => List.from(json.decode(str).map((x) => Nih.fromJson(x))); String nihToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); class Nih { int id; int userId; String piNames; String firstName; String middleName; String lastName; String organizationName; String departmentName; String orgCity; String orgState; String purpose; String institute; String totalCost; String projectStart; String projectEnd; String budgetStart; String budgetEnd; String createdOn; int piId; Nih({ required this.id, required this.userId, required this.piNames, required this.firstName, required this.middleName, required this.lastName, required this.organizationName, required this.departmentName, required this.orgCity, required this.orgState, required this.purpose, required this.institute, required this.totalCost, required this.projectStart, required this.projectEnd, required this.budgetStart, required this.budgetEnd, required this.createdOn, required this.piId, }); factory Nih.fromJson(Map json) => Nih( id: json["id"], userId: json["user_id"], piNames: json["pi_names"], firstName: json["first_name"], middleName: json["middle_name"], lastName: json["last_name"], organizationName: json["organizationName"], departmentName: json["departmentName"], orgCity: json["org_city"], orgState: json["org_state"], purpose: json["purpose"], institute: json["institute"], totalCost: json["total_cost"], projectStart: json["project_start"], projectEnd: json["project_end"], budgetStart: json["budget_start"], budgetEnd: json["budget_end"], createdOn: json["created_on"], piId: json["pi_id"], ); Map toJson() => { "id": id, "user_id": userId, "pi_names": piNames, "first_name": firstName, "middle_name": middleName, "last_name": lastName, "organizationName": organizationName, "departmentName": departmentName, "org_city": orgCity, "org_state": orgState, "purpose": purpose, "institute": institute, "total_cost": totalCost, "project_start": projectStart, "project_end": projectEnd, "budget_start": budgetStart, "budget_end": budgetEnd, "created_on": createdOn, "pi_id": piId, }; }