我如何在这个响应中读取所有数据
How i can read all data in this response?
我有这个JSON对象
{
"0": {
"id": "44",
"date": "2016-06-24 10:53:08",
"client_id": "44",
"status": "waiting",
"price": null,
"paid": null,
"client": false,
"items": {
"beirut": {
"52": {
"id": "52",
"type": "Kerosene",
"quantity": "50",
"price": "20100",
"address": "beirut"
}
}
}
},
"1": {
"id": "42",
"date": "2016-06-24 10:43:35",
"client_id": "44",
"status": "waiting",
"price": null,
"paid": null,
"client": false,
"items": {
"beirut": {
"50": {
"id": "50",
"type": "Super 98",
"quantity": "60",
"price": "34900",
"address": "beirut"
}
}
}
},
"status": "ok"
}
我想读取 javascript中响应的所有数据。
在jquery.ajax
调用中作为datatype:jsonp
返回。我能够访问数据,并显示所有的商店在html页面。
我怎么才能正确地阅读这个?
// Code goes here
var obj = {
"0": {
"id": "44",
"date": "2016-06-24 10:53:08",
"client_id": "44",
"status": "waiting",
"price": null,
"paid": null,
"client": false,
"items": {
"beirut": {
"52": {
"id": "52",
"type": "Kerosene",
"quantity": "50",
"price": "20100",
"address": "beirut"
}
}
}
},
"1": {
"id": "42",
"date": "2016-06-24 10:43:35",
"client_id": "44",
"status": "waiting",
"price": null,
"paid": null,
"client": false,
"items": {
"beirut": {
"50": {
"id": "50",
"type": "Super 98",
"quantity": "60",
"price": "34900",
"address": "beirut"
}
}
}
},
"status": "ok"
}
Object.keys(obj).forEach(function(key){
if (obj.hasOwnProperty(key)){
console.log(key,obj[key]);
}
})
相关文章:
- 如何将数据传递给Popup以及如何在Popup中读取数据
- 无法读取数据“;对象名称“;未定义的角度方向
- j查询在设置属性后在后续单击时不读取数据属性
- AngularJS:从HttpResponse中读取数据和标头
- Json通过Javascript读取数据
- 从指定的字符串中读取数据以创建选择元素
- 从 javascript 中的数组中读取数据
- 如何从节点.js请求对象读取数据事件(块)
- 无法从动态添加的 CKEditor 文本区域读取数据
- 如何从Firebase读取数据并将其写入文本框javascript
- 首先读取数据以决定在哪里使用 .pipe()
- 从剑道数据可视化图表读取数据
- 从请求标头读取数据
- PHP 从 XLS 或 HTML 读取数据并显示在 PHP 页面中
- 通过循环读取数据并将其插入数组
- 如何在jquery/javascript中从响应头中获取读取数据
- 无法读取数据表中未定义错误的属性“长度”.js
- 使用 d3.js 从 JSON 文件中读取数据
- 从 Instruments JavaScript 脚本中的数据库或文本文件中读取数据
- JavaScript IE 从 json 文件中读取数据 访问被拒绝