Json to treeview (<ul>)
Posted
by Pieter
on Stack Overflow
See other posts from Stack Overflow
or by Pieter
Published on 2010-05-18T20:07:18Z
Indexed on
2010/05/18
20:10 UTC
Read the original article
Hit count: 253
Hi I get the following data back from my WCF Data Service (I cut out the metadata)
{
"d" : [
{"CodeId": 6, "Title": "A Child Sub Item", "Parent":},
{"CodeId": 5, "Title": "Another Root Item", "Parent": -1},
{"CodeId": 4, "Title": "Child Item", "Parent": 2},
{"CodeId": 2, "Title": "Root Item", "Parent": -1}
]
}
I am trying to get this into a <ul> style tree with Parent = -1 as root and then the rest as sub items of their parent id's.
Can anyone help me please, preferably in jQuery? I will use this in jstree if someone knows of a better way to do this.
Thanks
© Stack Overflow or respective owner