I have the following sample file (fake #s) that shows a subset of the organization and the hierarchy levels. I am trying determine a way to get a nested JSON output that looks something like the code below where is references each employee # and who rolls up under who in the "children" section of the JSON data using the grid view.
There could be as many as 7-8 nested layers so having trouble figuring out how to iterate this to create the final JSON output.
[
{
"Id": "2",
"Name": "abc",
"Parent": "",
"children": [
{
"Id": "1",
"Name": "abc",
"Parent": "2",
"children": []
},
{
"Id": "4",
"Name": "abc",
"Parent": "2",
"children": []
},
{
"Id": "6",
"Name": "abc",
"Parent": "2",
"children": [
{
"Id": "7",
"Name": "abc",
"Parent": "6",
"children": []
},
{
"Id": "8",
"Name": "abc",
"Parent": "6",
"children": []
}
]
}
]
},
{
"Id": "5",
"Name": "abc",
"Parent": "",
"children": [
{
"Id": "3",
"Name": "abc",
"Parent": "5",
"children": []
}
]
}
]