【发布时间】:2011-07-31 17:14:06
【问题描述】:
我有嵌套的 JSON 对象,例如
{"baseball":
{"mlb":
{"regular":
{"_events": [{"start_time": "2011-07-31 17:35", "lines":
[{"comment": "", "coeff": "2.35", "title": "2", "old_coeff": "2.35", "is_main": true},
{"comment": "", "coeff": "1.59", "title": "2", "old_coeff": "1.59", "is_main": true},
{"comment": "", "coeff": "1.59", "title": "2", "old_coeff": "1.59", "is_main": true},
{"comment": "", "coeff": "2.35", "title": "2", "old_coeff": "2.35", "is_main": true}],
"members": ["atlanta", "florida"]
}
]
}}}}
我还需要获取 _events 数组并对其进行解析。但我不知道 _events 之前的单元格中会有什么以及它们将如何。我如何使用这种结构?
【问题讨论】:
-
恐怕这是什么时候使用 XML 而不是 JSON 的一个很好的例子,因为你可以使用 XPath 来做类似的事情。
-
@Gabi Purcaru 它是 JSON !!!尝试在jsonlint.com 验证它,你会为此投票,哇!
-
@Bakudan 不是在 OP 编辑它之前。
标签: javascript json