I am writing a Windows Phone app that will get a set of data from a server and display each entry in a list box.
The data comes from the server looking like this
{
"data": [
{
"value1": 777103069782066,
"value2": "SomeString",
"value3": "TextToDisplay1"
},
{
"value1": 750050696652932,
"value2": "SomeString2",
"value3": "TextToDisplay2"
},
{
"value1": 516092242936133,
"value2": "SomeString3",
"value3": "TextToDisplay3"
}
]
}
I know how to get the data into a dictionary like this
Dictionary<string, object> values = JsonConvert.DeserializeObject<Dic开发者_如何学Ctionary<string, object>>(json);
But it mashes it all into one dictionary entry (to be expected, that's all there is).
How can I take each of the dictionaries contained in the list - contained in the dictionary "data" and be able to store them in a variable(a list, with each list entry being a dictionary of data as shown above)?
Sorry if the question is kind of wordy. I can clarify if needed.
Thanks,
ChrisI don't know if it helps but maybe you should change your Dictionary declaration and Deserialization to Dictionary< string, Dictionary < string, object>>.
精彩评论