更新时间:2022-01-07 05:30:07
要解析json,您可以使用包dart:convert
中的json.decode(jsonString)
.但是首先,您需要修复格式.
To parse a json you can use json.decode(jsonString)
from package dart:convert
. But first, you need to fix the format.
在这种情况下,您可以使用例如replaceAll
方法添加双引号.
In this case, you could use for example replaceAll
method to add the double quotes.
String jsonString = "/*loaded json*/";
jsonString = jsonString.replaceAll('ModuleEId', '"ModuleEId"');
然后
final parsed = json.decode(jsonString);
完整示例: Dartpad