I need to create a dart Model class for this complex json .Please any one help
{
"status": "1",
"list": {
"4": [
{
"id": "1289",
"t": "Mutton biriyani",
"p": "21",
"i": "1289_5305.jpg",
"v": "0"
},
{
"id": "1288",
"t": "Chicken biriyani",
"p": "14",
"i": "1288_5339.jpg",
"v": "0"
}
]
}
}
can any one help
3
Answers
you can create modal of every json using this website json-to-dart.
and after making some changes the modal for your jsong would be something like this
Here is an example of a Dart Model class that could be used to parse the JSON you provided
}
}
And you can use it like this
final jsonMap = jsonDecode(jsonString);
final data = Model.fromJson(jsonMap);
Note that the List class is a basic type in dart, so it is not suitable for your json structure. In this case, you need to define a custom class for the "list" field.