Skip to content Skip to sidebar Skip to footer

Json Printing (treeview)

I have a complex json string that looks like this: { 'id':'2016666', 'dt':'2012', 'object_extends':[ { 'extend1':{ 'id':'201666

Solution 1:

Can you check these out:

How to generate Treeview from 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 -- one of my fav

I think visit this and use which you like:

https://github.com/search?utf8=%E2%9C%93&q=json+tree&type=Repositories&ref=searchresults

Edit For Your Request :

To remove the null nodes in https://github.com/tamirs9876/JSON.Tree.Builder -- one of my fav :

Cover line 8 with

if(data[i] != null){
}

in JsonTreeBuilder.js

Last state of js file is like

.
.
var ul = $('<ul>');
            for (var i indata) {
                var li = $('<li>');
                if(data[i] != null){
                    ul.append(li.text(i).append(generateTree(data[i])));
                }
            }
.
.

Post a Comment for "Json Printing (treeview)"