flutter print json object 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"
  }
}

//to access address field
var decodedJson = json.decode(myJson);
var jsonValue = json.decode(decodedJson['value']);
print(jsonValue['address']);

Example 2: flutter print json

Map userMap = jsonDecode(jsonString);
var user = User.fromJson(userMap);

print('Howdy, ${user.name}!');
print('We sent the verification link to ${user.email}.');