I have a table like this in my database.
CategoryID------ParentID-------Categor
1---------------------Null-------------Sports
2---------------------1-----------------Cricket
3---------------------2-----------------T20
4---------------------2-----------------ODI
5---------------------1-----------------Tennis
6---------------------5-----------------Singles
Now i want to retrieve whole table data and display the data in the form of Tree View. I tried to represent the data using "Tree" Data Structure in Java. After that i tried to convert the data into JSON Object by using GSON library. I am not able to produce the Json Tree data. I am facing so many problems. Can anyone please explain me how to convert the Data available in that table to Json tree Data. If json data is ready i can use alloy ui tree javascript to display the tree view in my Jsp.
CategoryID------ParentID-------Categor
1---------------------Null-------------Sports
2---------------------1-----------------Cricket
3---------------------2-----------------T20
4---------------------2-----------------ODI
5---------------------1-----------------Tennis
6---------------------5-----------------Singles
Now i want to retrieve whole table data and display the data in the form of Tree View. I tried to represent the data using "Tree" Data Structure in Java. After that i tried to convert the data into JSON Object by using GSON library. I am not able to produce the Json Tree data. I am facing so many problems. Can anyone please explain me how to convert the Data available in that table to Json tree Data. If json data is ready i can use alloy ui tree javascript to display the tree view in my Jsp.