如何使用JSON.NET反序列化? [英] How to deserialize with JSON.NET?

查看:156
本文介绍了如何使用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:

  • 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

这篇关于如何使用JSON.NET反序列化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆