使用Gson解析含有集合的json数据
json数据
{
"messageCode": "00000",
"message": "统计停车场枪口空闲及总数量成功!",
"data": [
{
"fastChargeLeisure": 0,
"tatolFastCharge": 15,
"slowChargeLeisure": 2,
"tatolSlowCharge": 2,
"carparkId": "1424"
},
{
"fastChargeLeisure": 5,
"tatolFastCharge": 17,
"slowChargeLeisure": 4,
"tatolSlowCharge": 3,
"carparkId": "1425"
}
]
}
Map map = gson.fromJson(json, Map.class);
List
注意:使用gson.fromJson解析成map对象,其中Integer类型会默认转换为Double