JSON array to C# Dictionary

后端 未结 6 1334
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-19 14:04

How do I convert a JSON array like this

[{\"myKey\":\"myValue\"},
{\"anotherKey\":\"anotherValue\"}]

to a C# Dictionary wi

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 14:29

    Since you can only deserialize from an object, do just that by manipulating the JSON string a little first. Wrap it in an object:

    json = String.Format("{{\"result\":{0}}}", json);
    

提交回复
热议问题