json 数组 js 获取值!

{

"rows":5,

"result":[

[{"item_id":"60","item_no":"0101010001","item_huo":"00001","item_name":"\u6563\u53f6\u751f\u83dc","item_price":"4.760","item_unit":"\u516c\u65a4","item_scale":"\u8ba1\u91cd","item_rem":"SYSC","stock_id":"87","stock_num":"0","stock_date":"2014-06-05 16:40:43","stock_weight":"0.000"}],


[{"item_id":"61","item_no":"0101010003","item_huo":"00003","item_name":"\u6cb9\u9ea6\u83dc","item_price":"4.360","item_unit":"\u516c\u65a4","item_scale":"\u8ba1\u91cd","item_rem":"YMC","stock_id":"88","stock_num":"0","stock_date":"2014-06-05 16:51:41","stock_weight":"0.000"}],


[{"item_id":"62","item_no":"0101010005","item_huo":"00005","item_name":"\u833c\u84bf","item_price":"7.760","item_unit":"\u516c\u65a4","item_scale":"\u8ba1\u91cd","item_rem":"TH","stock_id":"89","stock_num":"0","stock_date":"2014-06-05 16:51:45","stock_weight":"0.000"}],


[{"item_id":"63","item_no":"0101010006","item_huo":"00006","item_name":"\u82a6\u84bf","item_price":"5.760","item_unit":"\u516c\u65a4","item_scale":"\u8ba1\u91cd","item_rem":"LH","stock_id":"90","stock_num":"0","stock_date":"2014-06-05 16:51:46","stock_weight":"0.000"}],


[{"item_id":"64","item_no":"0101010008","item_huo":"00008","item_name":"\u5c0f\u83e0\u83dc","item_price":"5.960","item_unit":"\u516c\u65a4","item_scale":"\u8ba1\u91cd","item_rem":"XBC","stock_id":"91","stock_num":"0","stock_date":"2014-06-05 16:51:47","stock_weight":"0.000"}]

]

}

JSON 怎么获取 result 的值?


函数式编程
浏览 1168回答 2
2回答

森林海

<script>&nbsp; &nbsp; var str = {"rows":5,"result":[[{"item_id":"60","item_no":"0101010001","item_huo":"00001","item_name":"\u6563\u53f6\u751f\u83dc","item_price":"4.760","item_unit":"\u516c\u65a4","item_scale":"\u8ba1\u91cd","item_rem":"SYSC","stock_id":"87","stock_num":"0","stock_date":"2014-06-05 16:40:43","stock_weight":"0.000"}],[{"item_id":"61","item_no":"0101010003","item_huo":"00003","item_name":"\u6cb9\u9ea6\u83dc","item_price":"4.360","item_unit":"\u516c\u65a4","item_scale":"\u8ba1\u91cd","item_rem":"YMC","stock_id":"88","stock_num":"0","stock_date":"2014-06-05 16:51:41","stock_weight":"0.000"}],[{"item_id":"62","item_no":"0101010005","item_huo":"00005","item_name":"\u833c\u84bf","item_price":"7.760","item_unit":"\u516c\u65a4","item_scale":"\u8ba1\u91cd","item_rem":"TH","stock_id":"89","stock_num":"0","stock_date":"2014-06-05 16:51:45","stock_weight":"0.000"}],[{"item_id":"63","item_no":"0101010006","item_huo":"00006","item_name":"\u82a6\u84bf","item_price":"5.760","item_unit":"\u516c\u65a4","item_scale":"\u8ba1\u91cd","item_rem":"LH","stock_id":"90","stock_num":"0","stock_date":"2014-06-05 16:51:46","stock_weight":"0.000"}],[{"item_id":"64","item_no":"0101010008","item_huo":"00008","item_name":"\u5c0f\u83e0\u83dc","item_price":"5.960","item_unit":"\u516c\u65a4","item_scale":"\u8ba1\u91cd","item_rem":"XBC","stock_id":"91","stock_num":"0","stock_date":"2014-06-05 16:51:47","stock_weight":"0.000"}]]};&nbsp; &nbsp; alert(str.rows);&nbsp; &nbsp; for ( var p in str.result ){ // 方法&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; alert(str.result[p][0].item_id);&nbsp; &nbsp; }</script>很简单的,多用搜索啊哥。。

智慧大石

for(var i=0;i<json.result.length;i++){var jsons=json.result[i];}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript