I have the following json:
[
{
"key":"key1",
"value":"val1"
},
{
"key":"key2",
"value":"val2"
}
]
How can I deserialize it into an list/array of NameValuePair<string, string>
?
Example:
var json = "[{\"key\":\"key1\",\"value\":\"val1\"},{\"key\":\"key2\",\"value\":\"val2\"}]";
var serializer = new JavaScriptSerializer();
var result = serializer.Deserialize<List<KeyValuePair<string,string>>>(json);
The above code runs but the data inside the list is null
. I can extract the array into an List<Object>
though.