javascript - JSON printing (treeview) -
i have complex json string looks this:
{ "id":"2016666", "dt":"2012", "object_extends":[ { "extend1":{ "id":"2016666", "dt":"2012", "active":"true", "object_extend":[ { "extend2": { "id":"2016666", "secondary":null }, "extend3": { "id":"2016666", "pet":"willy" } } ] } } ] }
now want print tree, when searching days have modify json(which not option). how can print in treeview? tried loops each extend can have other attributes other objects. hope can me this!
can check these out:
how generate treeview json data using javascript
https://github.com/lmenezes/json-tree
https://github.com/liuwenchao/aha-tree
https://github.com/alexlibs/nitree
https://github.com/tamirs9876/json.tree.builder -- 1 of fav
i think visit , use like:
https://github.com/search?utf8=%e2%9c%93&q=json+tree&type=repositories&ref=searchresults
edit request :
to remove null nodes in https://github.com/tamirs9876/json.tree.builder -- 1 of fav :
cover line 8
if(data[i] != null){ }
in jsontreebuilder.js
last state of js file like
. . var ul = $('<ul>'); (var in data) { var li = $('<li>'); if(data[i] != null){ ul.append(li.text(i).append(generatetree(data[i]))); } } . .
Comments
Post a Comment