Hello people with a greater mind than my own.
I'm in need of serious help.
I have an excel data structure:
That I'm trying to turn into a JSON body structure that looks like this:
{
"Path_a1": {
"Field_1": 1,
"Field_2": 2
},
"Path_a2": [
{
"Field_1": 3,
"Field_2": 4
},
{
"Field_1": 5,
"Field_2": 6,
"Path_b2": [
{
"Field_1": 7,
"Field_2": 8
},
{
"Field_1": 9,
"Field_2": 10
}
]
}
]
}
I'm aware of the JSON convertor module and I have some experience with Dictionaries but it's the finding, and adding additional array elements when I come to them that's causing me an issue.
At the moment I'm looping through the row(s) then column(s) and extracting the Paths and Array sizes taking in "Path_a2[1]" and getting "Path_a2" , 1 but then when it comes to adding "Path_a2" , 2 everything falls over and I cannot for the life of me figure out how to do this. I've tried several different approaches to coding this which I won't put here because simply they don't work and anything I have will likely be pointless.
If anyone can help I'd be eternally grateful!
I'm in need of serious help.
I have an excel data structure:
Path_a1 | Field_1 | 1 | |
Path_a1 | Field_2 | 2 | |
Path_a2[1] | Field_1 | 3 | |
Path_a2[1] | Field_2 | 4 | |
Path_a2[2] | Field_1 | 5 | |
Path_a2[2] | Field_2 | 6 | |
Path_a2[2] | Path_b2[1] | Field_1 | 7 |
Path_a2[2] | Path_b2[1] | Field_2 | 8 |
Path_a2[2] | Path_b2[2] | Field_1 | 9 |
Path_a2[2] | Path_b2[2] | Field_2 | 10 |
That I'm trying to turn into a JSON body structure that looks like this:
{
"Path_a1": {
"Field_1": 1,
"Field_2": 2
},
"Path_a2": [
{
"Field_1": 3,
"Field_2": 4
},
{
"Field_1": 5,
"Field_2": 6,
"Path_b2": [
{
"Field_1": 7,
"Field_2": 8
},
{
"Field_1": 9,
"Field_2": 10
}
]
}
]
}
I'm aware of the JSON convertor module and I have some experience with Dictionaries but it's the finding, and adding additional array elements when I come to them that's causing me an issue.
At the moment I'm looping through the row(s) then column(s) and extracting the Paths and Array sizes taking in "Path_a2[1]" and getting "Path_a2" , 1 but then when it comes to adding "Path_a2" , 2 everything falls over and I cannot for the life of me figure out how to do this. I've tried several different approaches to coding this which I won't put here because simply they don't work and anything I have will likely be pointless.
If anyone can help I'd be eternally grateful!