0
我正在寻找解析json url /文件并仅从json获取顶级节点。如何解析Json对象以获取所需对象
JSON对象看起来是这样的:
{
"2017080350": {
"home": {
"score": {
"1": null,
"2": null,
"3": null,
"4": null,
"5": null,
"T": null
},
"abbr": "ARI",
"to": null
},
"away": {
"score": {
"1": null,
"2": null,
"3": null,
"4": null,
"5": null,
"T": null
},
"abbr": "DAL",
"to": null
},
"bp": 0,
"down": null,
"togo": null,
"clock": null,
"posteam": null,
"note": null,
"redzone": null,
"stadium": "Tom Benson Hall of Fame Stadium",
"media": {
"radio": {
"home": null,
"away": null
},
"tv": "NBC",
"sat": null,
"sathd": null
},
"yl": null,
"qtr": null
},
"2017080351": {
"home": {
"score": {
"1": null,
"2": null,
"3": null,
"4": null,
"5": null,
"T": null
},
"abbr": "ARI",
"to": null
},
"away": {
"score": {
"1": null,
"2": null,
"3": null,
"4": null,
"5": null,
"T": null
},
"abbr": "DAL",
"to": null
},
"bp": 0,
"down": null,
"togo": null,
"clock": null,
"posteam": null,
"note": null,
"redzone": null,
"stadium": "Tom Benson Hall of Fame Stadium",
"media": {
"radio": {
"home": null,
"away": null
},
"tv": "NBC",
"sat": null,
"sathd": null
},
"yl": null,
"qtr": null
}
}
我试图让是两个值2017080350
和2017080351
我可以读取并显示的内容不错,但我试图当有问题得到两个提到的节点?
使用Object.getOwnPropertyNames(obj)。 – dev8080
您能否在阅读内容时提供代码? – trincot
你想得到这两个键? – 2017-07-24 17:57:03