json viewer
json in editor

Simple JSON Viewer is the module built to beautify the given JSON.

Features:

  1. It can be used with any editor by adding a class "simple-json-viewer" to the HTML tag
  2. it can be used in custom JavaScript by calling the simpleJsonViewer function
  3. simpleJsonViewer function can be used in Ajax

Usage 1:

Just add some JSON in any html tag with the class name "simple-json-viewer"

<div class="simple-json-viewer">{ "name": "JsonViewer", "author": { "name": "Karthikeyan Manivasagam", "email": "karthikeyanm.inbox@gmail.com" ,"contact": [ { "location": "office" ,"number": 7358196062 } ,{ "location": "home" ,"number": 7358196062 } ] } }</div> 

Note : when you add json in drupal text editor then the text format should be "Full html" or selected text format should allow custom tags & classes in text editor

Usage 2:

Define your custom id or class with empty html tag call the simpleJsonViewer function with the custom json

<div id="custom-id"></div>


    var json = { "name": "JsonViewer", "author": { "name": "Karthikeyan Manivasagam", "email": "karthikeyanm.inbox@gmail.com" ,"contact": [ { "location": "office" ,"number": 7358196062 } ,{ "location": "home" ,"number": 7358196062 } ] } };

 $('#custom-id').simpleJsonViewer(json);
Supporting organizations: 

Project information

Releases