Answers for "implement .json in flutter"

5

read json file flutter

Future<String>_loadFromAsset() async {
  return await rootBundle.loadString("assets/quiz.json");
}

Future parseJson() async {
    String jsonString = await _loadFromAsset();
    final jsonResponse = jsonDecode(jsonString);
}
Posted by: Guest on October-16-2020
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

Code answers related to "implement .json in flutter"

Code answers related to "Javascript"

Browse Popular Code Answers by Language