如何使用单个对象的for循环遍历Restfulwebserivice。我不想用于每个循环,所以我该怎么做。我无法使用
获取数据for(var key in data) {
alert(data[key].hotel_geo_node.name);
if(data.hasOwnProperty(key)){
data[key].hotel_geo_node.name;
}
}
这是api代码。
{
"data": {
"4325474491990470056": {
"hotel_geo_node": {
"name": "The Capitol",
"tags": {
"hotel_chain_code": [
"nichendgrp"
],
"property_type": [
"Hotel"
],
"property_budget_category": [
"Luxury"
],
"others": [
"goibibo_hotel"
]
},
},
"4325474491990470057": {
"hotel_geo_node": {
"name": "The Capitol",
"tags": {
"hotel_chain_code": [
"nichendgrp"
],
"property_type": [
"Hotel"
],
"property_budget_category": [
"Luxury"
],
"others": [
"goibibo_hotel"
]
},
},
"4325474491990470058": {
"hotel_geo_node": {
"name": "The Capitol",
"tags": {
"hotel_chain_code": [
"nichendgrp"
],
"property_type": [
"Hotel"
],
"property_budget_category": [
"Luxury"
],
"others": [
"goibibo_hotel"
]
},
}
}
}