jQuery.renderJSON is a lightweight JSON-to-HTML visualisation plugin.
It provides a quick way of displaying a piece of JSON data in a user-friendly way.
By Marek -- @marekweb
Include the plugin by adding a <script>
element to your page, placing it after jQuery.
<script src="jquery.renderjson.js"></script>
Use the plugin on an element that you want to use as a container (where obj
is your JSON data).
$("#container").renderJSON(obj);
See the included example.html
which runs renderJSON and displays an example of a rendered JSON data object.
The following CSS classes can be used to style the output. They're all namespaced with a renderjson
prefix in order to avoid name collisions with other classes.
renderjson-container
renderjson-value
renderjson-key
renderjson-pair
renderjson-array
renderjson-object
renderjson-scalar
renderjson-string
renderjson-number
renderjson-null