flutter json object parsing code example
Example 1: flutter access json object inside object
myJson = {
"label": "This is a string",
"value": {
"address": "This is a string",
"country": "This is a string"
}
}
var decodedJson = json.decode(myJson);
var jsonValue = json.decode(decodedJson['value']);
print(jsonValue['address']);
Example 2: parse json to dart model
import 'dart:convert';
main() {
String nestedObjText =
'{"title": "Dart Tutorial", "description": "Way to parse Json", "author": {"name": "bezkoder", "age": 30}}';
Tutorial tutorial = Tutorial.fromJson(jsonDecode(nestedObjText));
print(tutorial);