My JSON file has a specific structure:
{
"a": "b",
"c": "d",
"e": {
"f": "g",
"h": "i"
}
}
I want to transform it into the following structure:
{
"name": "Root",
"parent": "null",
"children": [
{
"name": "a",
"parent": "Root",
"children": [
{
"name": "b",
"parent": "a"
}
]
},
{
"name": "c",
"parent": "Root",
"children": [
{
"name": "d",
"parent": "d"
}
]
},
{
"name": "e",
"parent": "Root",
"children": [
{
"name": "f",
"parent": "e",
"children": [
{
"name": "g",
"parent": "f"
},
{
"name": "h",
"parent": "e",
"children": [
{
"name": "i",
"parent": "h"
}
]
}
]
}
]
}
]
}
To create a collapsible-tree diagram, I need a clear parent-children hierarchy relationship in my JSON file. Apologies for any issues with the indentation.