jQuery plugin for displaying JSON data
Switch branches/tags
Nothing to show
Clone or download
Latest commit 132b9e4 Aug 22, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
json-viewer Fixed Arrow Size Issue Mar 21, 2017
LICENSE Initial commit Dec 19, 2014
README.md Added withQuotes options - fix #2 Apr 27, 2016
demo.html HTTPS Support for jQuery Library load Mar 21, 2017
package.json 1.1.0 Feb 16, 2016

README.md

jQuery json-viewer

json-viewer is a jQuery plugin for easily displaying JSON objects by transforming them into HTML.

Features:

  • Syntax highlighting
  • Collapse and expand child nodes on click
  • Clickable links
  • Easily readable and minimal DOM structure

Check out the demo page!

Usage

Import jquery.json-viewer.js and jquery.json-viewer.css in your application.

Then just call the jsonViewer() method and pass your JSON data in argument:

<pre id="json-renderer"></pre>
var data = {
  "foobar": "foobaz"
};
$('#json-renderer').jsonViewer(data);

Options

The jsonViewer method accepts an optional options hash as a second argument:

  • collapsed (boolean, default: false): all nodes are collapsed at html generation.
  • withQuotes (boolean, default: false): all JSON keys are surrounded with double quotation marks ({"foobar": 1} instead of {foobar: 1}).

Example:

$('#json-renderer').jsonViewer(data, {collapsed: true, withQuotes: true});

About