53 lines
1.5 KiB
Dart
53 lines
1.5 KiB
Dart
|
// To parse this JSON data, do
|
||
|
//
|
||
|
// final affiliationsData = affiliationsDataFromJson(jsonString);
|
||
|
|
||
|
import 'dart:convert';
|
||
|
|
||
|
AffiliationsData affiliationsDataFromJson(String str) =>
|
||
|
AffiliationsData.fromJson(json.decode(str));
|
||
|
|
||
|
String affiliationsDataToJson(AffiliationsData data) =>
|
||
|
json.encode(data.toJson());
|
||
|
|
||
|
class AffiliationsData {
|
||
|
List<Map<String, Datum>> data;
|
||
|
|
||
|
AffiliationsData({
|
||
|
required this.data,
|
||
|
});
|
||
|
|
||
|
factory AffiliationsData.fromJson(Map<String, dynamic> json) =>
|
||
|
AffiliationsData(
|
||
|
data: List<Map<String, Datum>>.from(json["data"].map((x) => Map.from(x)
|
||
|
.map((k, v) => MapEntry<String, Datum>(k, Datum.fromJson(v))))),
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"data": List<dynamic>.from(data.map((x) => Map.from(x)
|
||
|
.map((k, v) => MapEntry<String, dynamic>(k, v.toJson())))),
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class Datum {
|
||
|
List<String> affiliationNames;
|
||
|
List<String> affiliationCount;
|
||
|
|
||
|
Datum({
|
||
|
required this.affiliationNames,
|
||
|
required this.affiliationCount,
|
||
|
});
|
||
|
|
||
|
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
|
||
|
affiliationNames:
|
||
|
List<String>.from(json["affiliationNames"].map((x) => x)),
|
||
|
affiliationCount:
|
||
|
List<String>.from(json["affiliationCount"].map((x) => x)),
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"affiliationNames": List<dynamic>.from(affiliationNames.map((x) => x)),
|
||
|
"affiliationCount": List<dynamic>.from(affiliationCount.map((x) => x)),
|
||
|
};
|
||
|
}
|