如何在Flutter中解析JSON列表 [英] How to parse json lists in flutter
问题描述
我们如何在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屋!