Dealing with JSON data, my task is to count the number of strings within a specific child element and then group them by part of the string to create a table. While this may seem like a confusing and daunting challenge, it's what we need to accomplish.
Admittedly, I'm not entirely sure where to begin with this. Even displaying the strings accurately posed quite a challenge.
Below is a snippet of example JSON that I'm working with:
"DataValues": [
{
"Key": "Stuff Type",
"Id": "95492",
"ComboBoxPairs": [
{
"Value": {
"Key": "3 Gallon",
"Value": "3 Gallon",
"ExtraValues": []
},
"Children": [
{
"Key": "Scan",
"Id": "93478",
"Strings": [
"DogType:Lab,Age:3,Name:Bowser",
"DogType:Lab,Age:5,Name:Dingo",
...
]
}
]
},
{
"Value": {
"Key": "1 Gallon",
"Value": "1 Gallon",
...
}
]
}
]
My goal is to build a table like this:
DogType ContainerType Quantity Volume
Lab
3 Gallon 2 6 Gallon
Mutt
1 Gallon 1 1 Gallon
3 Gallon 2 6 Gallon
Weiner
3 Gallon 1 3 Gallon
Puppy
1 Gallon 2 6 Gallon
3 Gallon 4 12 Gallon
I am unsure how to proceed and if this even feasible. The table needs to be grouped by the 'DogType' substring from the strings. The quantity of each dog type in each container type will determine the values for the 'Quantity' and 'ContainerType' columns in the table. 'Volume' is calculated by multiplying the gallon value by the quantity.
Considering the dynamic nature of the data with potentially multiple container types, finding a solution seems overwhelming at this point.
The structure of the data was not designed by me and cannot be modified. Getting to this stage has been quite challenging. Does anyone have any suggestions on how to approach this problem?