开发者社区> 问答> 正文

extjs遍历json集合问题

后台使用级联查询两个表数据,向前段输出一个json集合,前台应该如何接收该json集合,以及前台如何将json遍历出来?
 附上json格式:{"datas":[{"cash":123,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":9,"day":6,"hours":19,"minutes":2,"month":3,"nanos":0,"seconds":31,"time":1460199751000,"timezoneOffset":-480,"year":116},"id":"402881e953fa67fe0153faaffeb30003","modifyDate":null,"state":false,"statu":1},{"cash":123,"consumerId":"402881e953ae826f0153ae82ddf10001","consumers":[],"createDate":{"date":9,"day":6,"hours":19,"minutes":3,"month":3,"nanos":0,"seconds":53,"time":1460199833000,"timezoneOffset":-480,"year":116},"id":"402881e953fa67fe0153fab140a50004","modifyDate":null,"state":true,"statu":1},{"cash":123,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":9,"day":6,"hours":19,"minutes":5,"month":3,"nanos":0,"seconds":20,"time":1460199920000,"timezoneOffset":-480,"year":116},"id":"402881e953fa67fe0153fab295170005","modifyDate":null,"state":true,"statu":1},{"cash":123,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":9,"day":6,"hours":19,"minutes":7,"month":3,"nanos":0,"seconds":22,"time":1460200042000,"timezoneOffset":-480,"year":116},"id":"402881e953fa67fe0153fab471bd0006","modifyDate":null,"state":true,"statu":1},{"cash":123,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":9,"day":6,"hours":19,"minutes":8,"month":3,"nanos":0,"seconds":59,"time":1460200139000,"timezoneOffset":-480,"year":116},"id":"402881e953fab5660153fab5ebeb0000","modifyDate":null,"state":true,"statu":1},{"cash":123,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":9,"day":6,"hours":19,"minutes":10,"month":3,"nanos":0,"seconds":20,"time":1460200220000,"timezoneOffset":-480,"year":116},"id":"402881e953fab5660153fab727a40001","modifyDate":{"date":9,"day":6,"hours":19,"minutes":10,"month":3,"nanos":0,"seconds":20,"time":1460200220000,"timezoneOffset":-480,"year":116},"state":true,"statu":1},{"cash":100,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":9,"day":6,"hours":19,"minutes":11,"month":3,"nanos":0,"seconds":23,"time":1460200283000,"timezoneOffset":-480,"year":116},"id":"402881e953fab5660153fab81cac0002","modifyDate":{"date":9,"day":6,"hours":19,"minutes":11,"month":3,"nanos":0,"seconds":23,"time":1460200283000,"timezoneOffset":-480,"year":116},"state":true,"statu":1},{"cash":100,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":9,"day":6,"hours":19,"minutes":12,"month":3,"nanos":0,"seconds":30,"time":1460200350000,"timezoneOffset":-480,"year":116},"id":"402881e953fab5660153fab9224c0003","modifyDate":{"date":9,"day":6,"hours":19,"minutes":12,"month":3,"nanos":0,"seconds":30,"time":1460200350000,"timezoneOffset":-480,"year":116},"state":true,"statu":1},{"cash":50,"consumerId":"402881e953ae826f0153ae82ddf10001","consumers":[],"createDate":{"date":7,"day":4,"hours":14,"minutes":36,"month":3,"nanos":0,"seconds":41,"time":1460011001000,"timezoneOffset":-480,"year":116},"id":"402881f353ef64290153ef6fe8010000","modifyDate":{"date":9,"day":6,"hours":19,"minutes":1,"month":3,"nanos":0,"seconds":34,"time":1460199694000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":123,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":14,"minutes":39,"month":3,"nanos":0,"seconds":53,"time":1460011193000,"timezoneOffset":-480,"year":116},"id":"402881f353ef64290153ef72d4be0001","modifyDate":{"date":8,"day":5,"hours":9,"minutes":38,"month":3,"nanos":0,"seconds":59,"time":1460079539000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":123,"consumerId":"402881e953ae826f0153ae82ddf10001","consumers":[],"createDate":{"date":7,"day":4,"hours":18,"minutes":25,"month":3,"nanos":0,"seconds":12,"time":1460024712000,"timezoneOffset":-480,"year":116},"id":"402881f353f02eaa0153f0411e0c0000","modifyDate":{"date":8,"day":5,"hours":18,"minutes":25,"month":3,"nanos":0,"seconds":12,"time":1460111112000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":31,"month":3,"nanos":0,"seconds":47,"time":1460032307000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b502e90000","modifyDate":{"date":8,"day":5,"hours":20,"minutes":39,"month":3,"nanos":0,"seconds":14,"time":1460119154000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":33,"month":3,"nanos":0,"seconds":6,"time":1460032386000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b6344d0001","modifyDate":{"date":8,"day":5,"hours":20,"minutes":39,"month":3,"nanos":0,"seconds":24,"time":1460119164000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":33,"month":3,"nanos":0,"seconds":17,"time":1460032397000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b65f3a0002","modifyDate":{"date":7,"day":4,"hours":9,"minutes":51,"month":3,"nanos":0,"seconds":34,"time":1459993894000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":33,"month":3,"nanos":0,"seconds":49,"time":1460032429000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b6dfaf0003","modifyDate":{"date":7,"day":4,"hours":20,"minutes":33,"month":3,"nanos":0,"seconds":49,"time":1460032429000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":34,"month":3,"nanos":0,"seconds":39,"time":1460032479000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b6dfaf0004","modifyDate":{"date":9,"day":6,"hours":19,"minutes":0,"month":3,"nanos":0,"seconds":43,"time":1460199643000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":34,"month":3,"nanos":0,"seconds":55,"time":1460032495000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b6dfaf0005","modifyDate":{"date":9,"day":6,"hours":19,"minutes":0,"month":3,"nanos":0,"seconds":40,"time":1460199640000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":35,"month":3,"nanos":0,"seconds":22,"time":1460032522000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b6dfaf0006","modifyDate":{"date":8,"day":5,"hours":12,"minutes":18,"month":3,"nanos":0,"seconds":35,"time":1460089115000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":35,"month":3,"nanos":0,"seconds":51,"time":1460032551000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b6dfaf0007","modifyDate":{"date":8,"day":5,"hours":10,"minutes":12,"month":3,"nanos":0,"seconds":35,"time":1460081555000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":36,"month":3,"nanos":0,"seconds":18,"time":1460032578000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b6dfaf0008","modifyDate":{"date":8,"day":5,"hours":10,"minutes":7,"month":3,"nanos":0,"seconds":45,"time":1460081265000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":36,"month":3,"nanos":0,"seconds":37,"time":1460032597000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b6dfaf0009","modifyDate":{"date":8,"day":5,"hours":10,"minutes":7,"month":3,"nanos":0,"seconds":43,"time":1460081263000,"timezoneOffset":-480,"year":116},"state":true,"statu":3},{"cash":50,"consumerId":"402881f353e4650e0153e544f6ce0004","consumers":[],"createDate":{"date":7,"day":4,"hours":20,"minutes":36,"month":3,"nanos":0,"seconds":55,"time":1460032615000,"timezoneOffset":-480,"year":116},"id":"402881f353f071b30153f0b6dfaf0010","modifyDate":{"date":9,"day":6,"hours":19,"minutes":1,"month":3,"nanos":0,"seconds":28,"time":1460199688000,"timezoneOffset":-480,"year":116},"state":true,"statu":3}],"pageCount":1,"pageIndex":1,"total":22}

展开
收起
杨冬芳 2016-07-07 16:55:36 2041 0
1 条回答
写回答
取消 提交回答
  • var jsonstr = "未知...";var jsondata = eval('(' + jsonstr + ')');for (var p in jsondata) {    console.log(p + ": " + jsondata[p]);}

    答案来源于网络

    2019-09-23 14:14:47
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载