如何在Flutter中解析JSON列表
问题内容:
我们如何在Flutter中解析此类列表数据?我尝试了不同的型号,但失败了。以下是数据:
[
{
"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无效且包含错误。
一般而言,有关如何解析JSON的信息,可以使用包中的json.decode(jsonString);
函数dart:convert
。有关更多信息,您可以访问以下站点:https : //flutter.io/docs/development/data-and-
backend/json