jQuery Plugin For Pretty JSON Formatting - jsonFormatter

File Size: 14.9 KB
Views Total: 3229
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin For Pretty JSON Formatting - jsonFormatter

jsonFormatter is a lightweight jQuery plugin used to beautify JSON strings with support for syntax highlighting, collapsible hierarchical structure and custom color schemes.

How to use it:

1. Load the core stylesheet in the head section of the document.

<link href="jsonFormatter.min.css" rel="stylesheet">

2. Load the jsonFormatter-darkTheme.min.css if you wish to use dark theme (Optional).

<link href="jsonFormatter-darkTheme.min.css" rel="stylesheet">

3. Call the plugin on the target element.

$('.demo').jsonFormatter();

4. Plugin options.

$('.demo').jsonFormatter({

// The number of spaces a tab
tab: '  ',

// Specifies if object's keys should be quoted in the formatted output.
quoteKeys: true,

// Specifies if arrays and objects are collapsible in the formatted output.
collapsible: true,

// Specifies if the original element is hidden. 
hideOriginal: true
});

This awesome jQuery plugin is developed by MHeironimus. For more Advanced Usages, please check the demo page or visit the official website.