How do I use JSON.NET to deserialize into nested/recursive Dictionary and List?

前端 未结 5 1005
-上瘾入骨i
-上瘾入骨i 2020-11-22 13:13

I need to deserialize a complex JSON blob into standard .NET containers for use in code that is not aware of JSON. It expects things to be in standard .NET

5条回答
  •  被撕碎了的回忆
    2020-11-22 13:53

    You can have full control over the serialization of a type by using a custom JsonConverter. Documentation at http://james.newtonking.com/projects/json/help/html/T_Newtonsoft_Json_JsonConverter.htm .

    Also, according to this blog post you need to use JArray for a List, and JObject for a dictionary.

提交回复
热议问题