关于调用别人接口返回JSON数组问题

当我调用别人的接口时,返回JSON结果里面有数组,我如何在JSP前端页面取得数组里面相关的数据。

例如:
"error_code":0,
"reason":"成功",
"result":[
{
"provinceId":"v2129",
"provinceName":"甘肃",
"cityList":[
{
"cityId":"v77068",
"cityName":"金昌",
"rechargeTypeList":[
{
"payProjectId":"c2680",
"payProjectName":"电费",
"payUnitId":"v8132216",
"payUnitName":"金昌供电公司",
"payModeList":[
{
"payModeId":"v2620",
"payModeName":"户号",
"productId":null,
"productName":null,
"inprice":null
}
]
}
]
},..........
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...},
Object{...}
]
}

2个回答

JSON.parse(data).result[0].provinceId 这个data 是你的json数据

下载一个JSONObject的包,然后把这个获得的数据通过JSONObject来解析就行了。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问