How to parse json in flutter?

While working with json data

The good practice is to create a model for that and then just fetch the data through the api

creating a model and a class is easy enough and doesn’t take effort and makes your work easy 😉

For creating a model for your project

VISIT https://javiercbk.github.io/json_to_dart/

just copy your json data and paste in the textField and you will get your Model Class ready with just one click

for accessing the data

Test _test = Test.fromJson(response.body);

that’s it.

refer image shown below

enter image description here

Leave a Comment