JSON array to C# Dictionary

后端 未结 6 1346
佛祖请我去吃肉
佛祖请我去吃肉 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:22

    I found that using a list of KeyValuePairs didn't work. I got the right number of elements but they had null Keys and Values.

    In the end the only solution that worked for me was deserialising to a list of dictionaries (which each had a single kvp element).

提交回复
热议问题