Nested JSON & Maps | Build Models | Nested
Models | Parsing Json | Flutter Dart
dbestech
This is a basic example of nested json over here of course
just a diagram and i 'll walk you through very quickly now
here in general nested jsons uh or any kind of json first it
will have curly braces and inside curly braces it will also
have a key and value this kind of section or part like here i
have these two curly braces. There are a few different
ways that you can create map like this is the first way you
can have first create a map instance using this constructor
and you create the case and put the value directly. There
are other different ways to declare map now for those
understanding you have to come over here. The most or
the most amazing part about this json and map they 're
pretty similar okay yeah i would say a lot of times 99
similar okay. So when when if you understand what is json
then get your header on map becomes pretty easy okay so
now here i 'll write say bangladesh and the cd daca so here
over here this is a map right.
In general you in in in your app in your flutter app you 'll
have your json this kind of json actually coming from the
server. Once you take it from the. server it pretty much
look like this okay so actually once you take. it from. the
server i would call it map instead of. json even though the
convention they say it 's all. all json but the format it gives
you most of the server side when you return data for
restful. API the data is pretty much json response and most
of them they have this. kind of. format. The idea is always
same just like we saw how json and map they 're similar
right so the ideas are all transferable okay anyway so to
build a model first we 'll create a class over here and the
class name i 'll declare person now why i 'm doing that
because here in this map i have person 's information okay
that 's why but you can name it anything you want here
first. A list of models over here right so that means for this
section i have to create a model and for the related field in
Models | Parsing Json | Flutter Dart
dbestech
This is a basic example of nested json over here of course
just a diagram and i 'll walk you through very quickly now
here in general nested jsons uh or any kind of json first it
will have curly braces and inside curly braces it will also
have a key and value this kind of section or part like here i
have these two curly braces. There are a few different
ways that you can create map like this is the first way you
can have first create a map instance using this constructor
and you create the case and put the value directly. There
are other different ways to declare map now for those
understanding you have to come over here. The most or
the most amazing part about this json and map they 're
pretty similar okay yeah i would say a lot of times 99
similar okay. So when when if you understand what is json
then get your header on map becomes pretty easy okay so
now here i 'll write say bangladesh and the cd daca so here
over here this is a map right.
In general you in in in your app in your flutter app you 'll
have your json this kind of json actually coming from the
server. Once you take it from the. server it pretty much
look like this okay so actually once you take. it from. the
server i would call it map instead of. json even though the
convention they say it 's all. all json but the format it gives
you most of the server side when you return data for
restful. API the data is pretty much json response and most
of them they have this. kind of. format. The idea is always
same just like we saw how json and map they 're similar
right so the ideas are all transferable okay anyway so to
build a model first we 'll create a class over here and the
class name i 'll declare person now why i 'm doing that
because here in this map i have person 's information okay
that 's why but you can name it anything you want here
first. A list of models over here right so that means for this
section i have to create a model and for the related field in