我有这个json -
[{"a":"2958081","b":"Contact Sport","e":"abc4 news sport recent","f":[{"a":"831081","f":"2011-09-30 23:00:00","g":"2011-10-14 23:00:00"},{"a":"831080","f":"2011-09-23 23:00:00","g":"2011-10-07 23:00:00"}]},{"a":"2959838","b":"ABC National Evening News","e":"news abc4 recent last-chance","f":[{"a":"831928","f":"2011-09-30 23:00:00","g":"2011-10-01 22:00:00"}]}]
给了我一个例外
“意外状态:已完成。第1行,第206位。”
使用以下代码:
doc = CType(Newtonsoft.Json.JsonConvert.DeserializeXmlNode(json, "root"), XmlDocument)
json
为string
,doc
为XmlDocument
有没有办法处理这些重复的数组结构?我只显示了2,完整的JSON文件(字符串)有~250(总共75K字节)。封闭整体的[]在显示的代码片段之前被删除。
答案 0 :(得分:0)
@VoidMain在CodePlex JSON.NET discussion提供了一个解决方案。
如上所述,它需要对字符串进行少量编辑,预先挂起{object:并附加}到json。
{objects:[{"a":"2958081","b":"Contact Sport","e":"abc4 news sport recent","f":[{"a":"831081","f":"2011-09-30 23:00:00","g":"2011-10-14 23:00:00"},{"a":"831080","f":"2011-09-23 23:00:00","g":"2011-10-07 23:00:00"}]},{"a":"2959838","b":"ABC National Evening News","e":"news abc4 recent last-chance","f":[{"a":"831928","f":"2011-09-30 23:00:00","g":"2011-10-01 22:00:00"}]}]}