- JavaScript Object Notation or JSON is an open-standard file format that uses human-readable text to transmit data objects consisting of attributes- value pairs and array data types.
- In simple language, JSON is simply a format in which you can transfer the data from client to server and server to client.
- When you are making network-connected apps using flutter, then chances are that it needs to consume some good old JSON, sooner or later. so let's discuss the basics of JSON in terms of flutter.
- Flutter has incredible support for this format as it allows you to convert objects from and to JSON very quickly.
- Here in the code attached, What’s inside curly brackets is called a JSON object and it’s always made up of a string, which is the key of the field, and a value which can be a string, a number, a Boolean, a list, null or another object.
- In Flutter, you can decide between manually parsing strings using facilities from import "dart:convert", or using automatic code generation, which does most of the work automatically.
- Both ways are fine but you’ll see that code generation simplifies the maintenance a lot, especially for large JSON objects.
- In all those cases where there’s the need to deal with a list or small objects, parsing and maintaining JSON manually is fine.
- When JSON strings are very complex, with many nested objects and lists, it would be better to use code generation which handles most of the tedious work automatically.
- If you want to understand JSON in simple terms check out this video:- youtube.com for Flutter Devs, check out this official flutter guide by the flutter community on JSON
- For non Flutter developers, here are some resources to learn more about JSON W3schools:- w3schools.com
Awesome JSON:- burningtree awesome-json
Thank you for Reading :)