Json to treeview (<ul>)
- by Pieter
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