如何在Flutter中解析JSON列表 [英] How to parse json lists in flutter

查看:1084
本文介绍了如何在Flutter中解析JSON列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在Flutter中解析此类List数据?我尝试了不同的型号,但失败了.以下是数据:

How can we parse such type of List data in Flutter? I tried different models but failed. Following is the data:

[
    {
        "course":"Computer Architecture Fall 2018 - KHI",
        "pending_assignment":[
            {
                "name":"OOAD Project Fall 2018 Section B & D",
                "dueDate":"Dec 14, 2018 10:00 pm"
            }
        ]
    },
    {
        "course":"Object Oriented Analysis and Design Fall 2018 - KHI",
        "pending_assignment":[
            {
                "name":"OOAD Project Fall 2018 Section B & D",
                "dueDate":"Dec 14, 2018 10:00 pm"
            }
        ]
    }
]

推荐答案

您可以在此网站上查询( http://json.parser.online.fr/),则JSON无效且包含错误.

As you can check with this website (http://json.parser.online.fr/), that JSON is not valid and contains errors.

有关通常如何解析JSON的信息,可以使用dart:convert包中的json.decode(jsonString);函数.有关更多信息,您可以访问以下站点: https://flutter. io/docs/development/data-and-backend/json

For how to parse JSON in general, you can use the json.decode(jsonString); function from the dart:convert package. For more information on that you can check out this site: https://flutter.io/docs/development/data-and-backend/json

这篇关于如何在Flutter中解析JSON列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆