convert data to json obect flutter code example
Example 1: flutter convert json string to json
flutter convert json string to json
----------------------
var x1 = '[{"id": "1"}]';
List<dynamic> x2 = jsonDecode(x1);
print(x2[0]);
Example 2: flutter json to class
ClassName.fromJson(Map<String, dynamic> json) {
variable1 = json['variable11'];
variable2 = json['variable12'];
variable3 = json['variable13']['variable14'];
}
Map<dynamic, dynamic> res = await jsonDecode(response.body.toString());
Classname.fromJson(res);