Answers for "how to retrieve data from json in flutter"

0

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']);
Posted by: Guest on October-30-2020
0

how to fetch data from json file in flutter

import 'dart:convert';

main() {
  String jsonS = """{
    "stream": {
        "tv": [{
            "name": "Tv",
            "description": "Tv",
            "url": "this is the url",
            "image": "imagelink"

        }]
    }
}""";
  var myMap = json.decode(jsonS);
  var myName = myMap['stream']['tv'][0]['name'];
  print('${myName}');
}
Posted by: Guest on July-04-2021

Code answers related to "how to retrieve data from json in flutter"

Code answers related to "Javascript"

Browse Popular Code Answers by Language