# jquery.json-viewer **Repository Path**: itphy/jquery.json-viewer ## Basic Information - **Project Name**: jquery.json-viewer - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-12-10 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 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](http://rawgit.com/abodelot/jquery.json-viewer/master/demo.html)! ## Install Copy sources from git repository, or use npm: ```sh npm install jquery.json-viewer ``` Make sure jQuery is already included. Then import `jquery.json-viewer.js` and `jquery.json-viewer.css` in your HTML document: ```html
``` ## Usage Call the `jsonViewer()` method on target element and pass your JSON data in argument: ```html ``` ```js var data = { "foobar": "foobaz" }; $('#json-renderer').jsonViewer(data); ``` ## Options The `jsonViewer` method accepts an optional config object as a second argument. The supported options are: - `collapsed` (boolean, default: `false`): all nodes are collapsed at html generation. - `rootCollapsable` (boolean, default: `true`): allow root element to be collasped. - `withQuotes` (boolean, default: `false`): all JSON keys are surrounded with double quotation marks (`{"foobar": 1}` instead of `{foobar: 1}`). - `withLinks` (boolean, default: `true`): all values that are valid links will be clickable, if `false` they will only be strings. Example: ```js $('#json-renderer').jsonViewer(data, {collapsed: true, withQuotes: true, withLinks: false}); ``` ## About - Author: [Alexandre Bodelot](https://github.com/abodelot) - License: [MIT License](http://opensource.org/licenses/MIT)