The best way to parse a JSON in Dart

Simply use json of the dart:convert package. Here is an example :

import 'dart:convert';

main() {
  final myJsonAsString = '{"a": 1, "b": "c"}';
  final decoded = json.decode(myJsonAsString);
  ....
}

See Parsing JSON for more details.

Leave a Comment