The Best way to Parse a JSON in Dart

I’m trying to load a json file from a URL and parse it within Dart. So I had tried the following code as suggested from some links when I google for it:

     var model = new JSON.parse(response);

However, it seems to not work anymore on Dart SDK version What is the current best way to get a Json file mapped to an object in Dart?

This Post Has One Comment

  1. No Fault

    Here is my solution ๐Ÿ™‚ At first, you need to import the convert package:

    import ‘dart:convert’;

    var res = json.decode(response.body);
    then you can get values by key, like below:


Leave a Reply