Reputation: 663
I have a json stored as string like below
String json="[{"name":"a","id",1},{"name":"b","id",2},{"name":"c","id",3}]";
My Question how to encode this to a map or a list to get access to the keys and use the values?
Upvotes: 1
Views: 81
Reputation: 657068
You need to JSON-decode the value first
import 'dart:convert';
final decoded = jsonDecode(json);
print(decoded[0]['name']); // just one example
Upvotes: 3