flutter解析json数组
json
适用于现代 C++ 的 JSON。
项目地址:https://gitcode.com/gh_mirrors/js/json

·
直接上代码:
List responseJson = json.decode(response);
List<CardBean> cardbeanList = responseJson.map((m) => new CardBean.fromJson(m)).toList();
CardBean cardBean = cardbeanList.first;
其中response的格式如下:
[
{ “img”: “images/viio-2”,“price”: 12.0,“title”: “海边码头的爱情主题结婚照拍摄”,“ftitle”: “让大海见证你们的爱情,让幸福记录在码头上”,“num”: 0}
,{ “img”: “images/viio-2”,“price”: 12.0,“title”: “海边码头的爱情主题结婚照拍摄”,“ftitle”: “让大海见证你们的爱情,让幸福记录在码头上”,“num”: 0}
]
注意:response是字符串,而不是JSON对象.




适用于现代 C++ 的 JSON。
最近提交(Master分支:6 个月前 )
51a77f1d
3 天前
756ca22e
3 天前
更多推荐
所有评论(0)