Json.net deserialized nested Dictionary

前端 未结 1 434
醉酒成梦
醉酒成梦 2021-01-12 16:15

I am using Json.NET to deserialized an object which included a nested Dictionary. Here is a sample of what i am trying to do

public interface IInterface
{
         


        
相关标签:
1条回答
  • 2021-01-12 16:33

    The issue is that JSON dictionaries (objects) only support string keys, so Json.Net converts your complex key type to a Json string (calling ToString()) which can't then be deserialized into the complex type again. Instead, you can serialize your dictionary as a collection of key-value pairs by applying the JsonArray attribute.

    See this question for details.

    0 讨论(0)
提交回复
热议问题