The best way to parse a JSON in Dart

后端 未结 6 2035
温柔的废话
温柔的废话 2020-12-09 16:43

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:

            


        
6条回答
  •  南笙
    南笙 (楼主)
    2020-12-09 16:46

    in my case

    JSON.decode

    didn't work.

    Instead I had to use :

    import 'dart:convert' as JSON;
    
    final json=JSON.jsonDecode(myJsonAsString);
    

提交回复
热议问题