Decoding JSON in Flutter
169
Var _response = JsonDecode(response.body) ;
print(_response[0]['key1']);

Author by
Admin
Updated on December 07, 2022Comments
-
Admin 6 months
REST_API provides a JSON Object like this:
[ { "key1":"value1" "key2":"value2" } ]
Question: How can I Parse that with Dart? I do not get it running. My main problem is that any approach with json.decode will remove all annotations so strings are no longer strings.
Sure I could cut of the square brackets at the beginning and at the end but thats not what i would call good coding.
Maybe some of you can help ;-)
Have a great day!
-
Dinesh Nagarajan almost 2 yearshope this helps stackoverflow.com/a/68927261/2804581
-
Admin almost 2 yearsYes that was the solution!
-