I'm using a Json string from another system. It looks something like this:
{
"BoolValue": true,
"Inventory": {
"Item1": {
"id": "1",
"name": "Item One"
},
"Item2": {
"id": "2",
"name": "Item Two"
},
"Item3": {
"id": "2",
"name": "Item Three"
}
}
}
How would I deserialize the "Item" objects to a List? I know it's easy then the json uses an array for "Inventory": [] but how will I do it when it's just object after object under the Inventory property?
List; they have a key/value structure. You'll need a hash table of some type like aDictionary<T>. Either way, in order to deserialize you'll need a class definition for that.