That would depend on what the array looked like. If you just have an array of values then you still need a key as part of the KeyValuePair. If you have a JSON array of JSON objects then from within the object you need to determine what the key and value should be. In some cases you would need a custom JsonConverter.
Hi Troy,
I am looking for a way to deserialize a JSON return with array type into a list of KeyValuePair.
Following some online resources I am able to deserialize array elements into a List > public List student { get; set; }
Can I do something like:
public List> student { get; set; }
So that I could have access to a particular student without looping through the whole list?
That would depend on what the array looked like. If you just have an array of values then you still need a key as part of the KeyValuePair. If you have a JSON array of JSON objects then from within the object you need to determine what the key and value should be. In some cases you would need a custom JsonConverter.