Issue
I have an API that returns a JSON of this structure:
{
"1":[
{
"name":"One"
},
{
"name":"Two"
}
],
"2":[
{
"name":"Three"
}
]
}
I need to deserialize it in C# using Newtonsoft.Json. I have tried deserializing in a
List<List<Response>>
but it didn't work.
I understand that the JSON is not necessarily good, but I can't change it since it's on a third party server.
Every help is appreciated.
Solution
Deserialize into a dictionary (or SortedDictionary, if the order of the elements in the dictionary matter), then take the dictionary's Values collection and run...
Answered By - LivingOnTheRoad Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.