如何使用JSON.NET反序列化?
问题描述:
如何设置Newtonsoft Json.net将该文本反序列化为.NET对象?
How do I setup Newtonsoft Json.net to deserialize this text into a .NET object?
[
[
"US\/Hawaii",
"GMT-10:00 - Hawaii"
],
[
"US\/Alaska",
"GMT-09:00 - Alaska"
],
]
对于奖励积分,杰森所说的这种结构是什么.我尝试寻找匿名对象,但没有任何运气.
For bonus points, what is this kind of structure called in Json. I tried looking for anonymous objects, but didn't have any luck.
答
JSON.Net使用JArray
允许对其进行解析-请参阅:
JSON.Net uses JArray
to allow these to be parsed - see:
- 使用DataContractJsonSerializer反序列化变量类型JSON数组(问题是关于DataContract的问题-答案是关于JSON.Net的-来自JSON.Net的作者)
- Json.NET:对数组进行序列化/反序列化
- Deserializing variable Type JSON array using DataContractJsonSerializer (the questions is about DataContract - but the answer is about JSON.Net - and is from JSON.Net's author)
- Json.NET: serializing/deserializing arrays