So I have a quick question. I have a very large json file that has around 20,000 json objects within an array, and each of those objects have 3 additional nested objects (separate from each other) within them. Example:
[
{
"id": 0,
"name": "Dwarf remains",
"exchangeable": false,
"members": true,
"placeholder_id": 17851,
"actions": {
"inventory": {
"fourthop": "Destroy"
},
"world": {
"secondop": "Take"
}
}
},
{
"id": 1,
"name": "Toolkit",
"exchangeable": false,
"members": true,
"placeholder_id": 17852,
"actions": {
"inventory": {
"fourthop": "Destroy"
},
"world": {
"secondop": "Take"
}
}
},
{
"id": 2,
"name": "Cannonball",
"exchangeable": true,
"members": true,
"placeholder_id": 17853,
"values": {
"value": 5,
"alchemy_high": 3,
"alchemy_low": 2
},
"actions": {
"inventory": {
"fourthop": "Drop"
},
"world": {
"secondop": "Take"
}
}
},
{
"id": 3,
"name": "Nulodion\u0027s notes",
"exchangeable": false,
"members": true,
"placeholder_id": 17854,
"actions": {
"inventory": {
"0": "Read",
"fourthop": "Destroy"
},
"world": {
"secondop": "Take"
}
}
},
{
"id": 4,
"name": "Ammo mould",
"exchangeable": false,
"members": true,
"placeholder_id": 17855,
"values": {
"value": 5,
"alchemy_high": 3,
"alchemy_low": 2
},
"actions": {
"inventory": {
"fourthop": "Drop"
},
"world": {
"secondop": "Take"
}
}
},
{
"id": 5,
"name": "Instruction manual",
"exchangeable": false,
"members": true,
"placeholder_id": 17856,
"values": {
"value": 10,
"alchemy_high": 6,
"alchemy_low": 4
},
"actions": {
"inventory": {
"0": "Read",
"fourthop": "Drop"
},
"world": {
"secondop": "Take"
}
}
},
{
"id": 6,
"name": "Cannon base",
"exchangeable": true,
"members": true,
"noted_id": 7,
"placeholder_id": 17857,
"values": {
"value": 187500,
"alchemy_high": 112500,
"alchemy_low": 75000
},
"actions": {
"inventory": {
"0": "Set-up",
"fourthop": "Drop"
},
"world": {
"secondop": "Take"
}
}
},
{
"id": 8,
"name": "Cannon stand",
"exchangeable": true,
"members": true,
"noted_id": 9,
"placeholder_id": 17858,
"values": {
"value": 187500,
"alchemy_high": 112500,
"alchemy_low": 75000
},
"actions": {
"inventory": {
"fourthop": "Drop"
},
"world": {
"secondop": "Take"
}
}
}
]
Now if I only want to deserialize the root object of each item:
"id": 8,
"name": "Cannon stand",
"exchangeable": true,
"members": true,
"noted_id": 9,
"placeholder_id": 17858,
(This section) Would I still need to create the three other additional classes for the values, actions, and world objects nested within each item, or is there a way to simply use a class resembling only the root object without those 3 areas and still have it all deserialize properly?
Or even to simply just pull the item name and id# and place them in a list? I ask because I'd rather not go ahead and waste my time if it is not possible. I've read several other threads but can't seem to find a clear indication to this specific instance. Other threads and articles/tutorials I've read about deserializing nested json objects tend to be talking about a json strings that are either not an array, they only wish to grab a single element, or the nesting is done differently.
So is this possible? And if so could you simply give me a little pointer or a link to something that may explain this sort of idea. Doesn't have to be super in depth, just really need someone to point the direction so I can find it easier. I've been searching threads for hours now with no luck.
Also one additional question, what would be the best way to store the item name and id number (other than a database) so that a user may search the item name in a textbox/combobox with autocomplete and that once the item is selected it will use the corresponding id number to search that number in another api.
Is there any decent way of doing this or should I stick with my original thought of simply importing this json array into a dataset and then save it as xml and simply import the xml to the dataset on startup?
I'd rather avoid this simply so instead of users needing to constantly check for new versions of the xml file they can simply grab the up to date json every startup and make use of that. That way I only need to worry about changing the file on the api.
Note: I tried to make sure this was not a duplicate post and looked at several threads with no avail. However, I'm running on only a few hours sleep and it is entirely possible for me to have made a mistake. If I did, and this is a duplicate post, please let me know and I apologize in advance if it is. I tried my very best at the moment to make sure I didn't duplicate a thread.
