I need to provide the below mentioned JSON output through asp.Net Web API. this output will be used to display the organization hierarchy(treeview) in angular.
I have employees data in SQL table as below:
EMP_NO EMP_NAME DESIGNATION Manager_ID
Required JSON output:
myobject= {
"parent":[
{
"name":"radha Acharya",
"designation":"General Counsel",
"state":"",
"active":false
},
{
"name":"Rakesh mishra",
"designation":"General Counse2",
"state":"",
"active":false
},
{
"name":"Suri patil",
"designation":"General Counse3",
"state":"",
"active":true
}
],
"childs":[
{
"name":"child 1",
"designation":"Deputy General Counsel",
"state":"",
"active":false,
"hasChilds":true
},
{
"name":"child 2",
"designation":"Deputy General Counsel",
"state":"",
"active":false,
"hasChilds":true
},
{
"name":"child 3",
"designation":"Deputy General Counsel",
"state":"",
"active":false,
"hasChilds":false
},
{
"name":"child 4",
"designation":"Deputy General Counsel",
"state":"",
"active":false,
"hasChilds":true
},
{
"name":"child 5",
"designation":"Deputy General Counsel",
"state":"Resigned",
"active":false,
"hasChilds":true
},
{
"name":"child 6",
"designation":"Deputy General Counsel",
"state":"",
"active":false,
"hasChilds":true
}
]
}
in angular it will be displaying like this Front end display image