I wonder if there is a built in method to translate a JSON like below to a tree with ul’s and li’s.
Example JSON:
{
{parent=-1,id=0,name='root'},
{parent=0,id=1,name='x'},
{parent=0,id=2,name='y'},
{parent=1,id=3,name='z'},
{parent=1,id=4,name='w'},
{parent=1,id=5,name='c'},
{parent=2,id=6,name='d'}
}
Here is a function that I intentionally leave unexplained.
It turns this
into this
See it here: http://jsfiddle.net/Tomalak/uUBKf/