My table structure is:
Id name size type parrent_Id
1 AAAA 2k t1 null
2 BB 2k t2 1
3 CC 1k t3 1
4 DDDD 2k t4 null
5 EE 2k t5 4
6 FF 1k t6 5
I need a SQL query that generates JSON structure from table to use it in primeng tree table component. It requires JSON structure like this. iam using asp.net core web api with sql server:
{
"data":
[
{
"data":{
"name":"Documents",
"size":"2k",
"type":"Folder"
},
"children":[
{
"data":{
"name":"Work",
"size":"5k",
"type":"Folder"
},
]
}
]