So I need to be able to iterate through a json file, looking for entries to add to new entries. This is mostly so I can update a json file between games or when they update. Normally I am good at this, but these json files are formatted in a way I am not used to.
Example json:
[
{
"Category": "Food",
"Types": [
888,
784654,
484,
44841
]
},
{
"Category": "",
"Types": [
4854
]
}
]
I want to take every number from Food and other named Category's and not the empty categories and create a new entry at the root of the json with the numbers
New entry:
"Category": "",
"Types": [
888
]
Final code example:
{
"Category": "Food",
"Types": [
888,
784654,
484,
44841
]
},
{
"Category": "",
"Types": [
4854
]
},
{
"Category": "",
"Types": [
888
]
},
{
"Category": "",
"Types": [
784654
]
},
{
"Category": "",
"Types": [
484
]
},
{
"Category": "",
"Types": [
44841
]
}