Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

how to get hierarchical Json Tree data using WebApi

$
0
0

how can i create unlimited  children level with  nested tree Json data.

like 

[{
 id: 1
 text: 'category1'
 parentid:0,
 children:[{
 id: 1
 text: 'sub1'
 parentid:1,},{id: 100
 text: 'sub2'
 parentid:1,
  children:[]
 }]
},
{
 id: 2
 text: 'category2'
 parentid:0,
 children:[{
 id: 101
 text: 'sub3'
 parentid:2,
       children:[
	   {id:200 
        text: 'sub3a'
        parentid:101,
	    children:[]},
	   {
	    id:201 
        text: 'sub3b'
        parentid:101,
	    children:[]}
	   ]
	}]
}

{
 id: 3
 text: 'category3'
 parentid:0,
 children:[{
 id: 101
 text: 'sub4'
 parentid:3,
       children:[
	   {id: 300 
            text: 'sub4a'
            parentid:101,
	        children:[
		     {
	           id:401 
                   text: 'sub4b'
                    parentid:300,
	            children:[]}
		]}
	   
	   ]
	}]
}
]

Appreciate for post any sample code and advices.


Viewing all articles
Browse latest Browse all 4850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>