views:

32

answers:

1

I am looking for a javascript library which renders an arbitrary (but acyclic) JSON data blob into some sort of semi-interactive HTML view. James Padolsey's Prettyprint library comes close, but its output is very verbose ("object" and "array" headers on everything, for instance), is only marginally interactive (the ability to collapse and expand subtrees would be nice, especially) and not particularly customizable. I also found jstree, but it looks like that doesn't do arbitrary JSON data blobs, only ones specifically constructed to be fed to it. Also, a strict treeview is not really right for the data I have; I want more of a key/value presentation (but with some values being nested objects).

I do not need the ability to modify the data structure, just show it in a more-or-less human readable fashion.

Any suggestions?

+1  A: 

I have a small project to display jsobjects.

Its not very pretty and could use some improvements but it might help out a little.

It is built on "jquery-1.4.2.min.js" but should work with older versions.

Files:
http://empirium.dnet.nu/js/object-browser.js
http://empirium.dnet.nu/js/object-browser.css

This is an example on how to use it:

http://empirium.dnet.nu/OBTest.html

Clicking on the bold black type will open and close complex datastructures that are not visible imediatly.

I hope you have some use for it and if you have any suggestions please just comment here.

Its not an active project, just something I wrote to do some debugging.

David Mårtensson