I have a json file with the following structure:
{
"a": "b",
"c": "d",
"e": {
"f": "g",
"h": "i"
}
}
I would like it to have 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"
}
]
}
]
}
]
}
]
}
I would like to have a parent-children hierarchy relationship so that it would be easier to draw a collapsible-tree diagram with nodes.Please forgive if the indentation is not proper.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…