🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

jQuery pretty-print-json is a web-based tool used to format/beautify JSON data and colorize key/value pairs depending on the data type.

json JSON-viewer

Documentation

pretty-print-json

logo

JavaScript library to pretty-print JSON data to HTML for formatted color display

License:MIT npm Dependencies Vulnerabilities Build

screenshot

Try it out

Interactive online tool to format JSON:
https://pretty-print-json.js.org

Setup

Browser

Load from the jsdelivr.com CDN:

<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/dist/pretty-print-json.css> ... <script src=https://cdn.jsdelivr.net/npm/[email protected]/dist/pretty-print-json.min.js></script>

node

Install package from npm:

$ npm install pretty-print-json

Import into your application:

const prettyPrintJson = require('pretty-print-json');

Usage

Example HTML:

<pre id=account></pre>

Pass data into prettyPrintJson.toHtml() and display the results:

const data = { active: true, codes: [48348, 28923, 39080], city: 'London' }; $('#account').html(prettyPrintJson.toHtml(data));

MIT License | Blog post


You May Also Like