JSON Formatter
jsonformatter.org
Best JSON Formatter and JSON Validator: Online JSON Formatter
Online JSON Formatter / Beautifier and JSON Validator will format JSON data, and helps to validate, convert JSON to XML, JSON to CSV. Save and Share JSON
JSON Parser
Online JSON Parser helps to parse, view, analyze JSON data in Tree View. It's a pretty simple and easy way to parse JSON data and share it with others.
JSBeautifier
Online JS Beautifier helps to Beautify Javascript. This Javascript Beautifier helps to unminify, Save and Share Javascript.
XML Formatter
Online XML Formatter will format xml data, helps to validate, and works as XML Converter. Save and Share XML.
Best JSON Pretty Print Online
Best JSON Pretty Print tool to Make Pretty JSON and JSON Print in color and Save and Share Online.
JSON Formatter
jsonformatter.curiousconcept.com
JSON Formatter & Validator
The JSON Formatter & Validator beautifies and debugs JSON data with advanced formatting and validation algorithms.
Videos
06:10
Pretty Print JSON in Your Terminal with jq or Python - YouTube
02:38
JavaScript tips β Pretty print json strings with JSON.stringify ...
07:00
Python Pretty Print JSON String: Enhance Readability with Proper ...
00:39
Tips and Tricks: Pretty printing JSON - YouTube
00:56
How to Pretty Print Json In the Browser Dev Tools Console - YouTube
00:32
Printnig Pretty JSON With C# - YouTube
JSONLint
jsonlint.com βΊ json-pretty-print
JSON Pretty Print - Format & Beautify JSON Online | JSONLint | JSONLint
Pretty print JSON instantly with our free online formatter. Customize indentation, sort keys, and beautify minified JSON. No signup required.
JSON Pretty
json-pretty.com
JSON Pretty β simple JSON formatter and editor
JSON Pretty help you to format, edit and pretty print json data. A powerful json formatter, editor and beautify tool for easy data readability.
Zerodevx
zerodevx.github.io βΊ json-pretty-print
JSON Pretty Print Online - Open Source
Convert unformatted JSON into pretty-printed JSON and send the view as a shareable web link.
Jsonprettyprint
jsonprettyprint.net
β
JSON Pretty Print π
JSON Pretty Print 5 stars - "JSON Pretty Print" - Steve Wozniak In all my years as a programmer I worked with a lot of APIs. Whenever I get raw JSON responses from APIs I like to use JSON Pretty Print to format JSON to make it more readable. I've tried a lot of online viewers but this one is the best by a mile because of it's simplicity.
JSON Editor Online
jsoneditoronline.org
JSON Editor Online: edit JSON, format JSON, query JSON
Format JSON is the same as beautify JSON : you make your JSON file readable by styling it with white spacing, newlines, and indentation. In short: paste your JSON file, then click the "Format" button in code mode, or select "Copy formatted" ...
Package Control
packagecontrol.io βΊ packages βΊ Pretty JSON
Pretty JSON - Packages - Package Control
To prettify JSON, make selection of json (or else it will try to use full view buffer) and through Command Palette Ctrl+Shift+P find βPretty JSON: Format JSONβ (you can search for part of it like 'pretty format')
Jsonpretty
jsonpretty.org
JsonPretty - JSON Beautifier and Formatter
Working with JSON data can be a complex task, especially when the code is poorly formatted or difficult to read. JSON Pretty is an invaluable online tool designed to solve this problem by instantly beautifying your JSON data.
LornaJane
lornajane.net βΊ posts βΊ 2024 βΊ pretty-print-json-with-jq
Pretty-print JSON with jq | LornaJane
jq is a JSON tool, and the "." part is technically a filter β but it includes everything, so itβs more like a not-filter. The output of jq is the same JSON that we put in, but itβs pretty-printed.
Top answer 1 of 16
6935
Pretty-printing is implemented natively in JSON.stringify(). The third argument enables pretty printing and sets the spacing to use:
var str = JSON.stringify(obj, null, 2); // spacing level = 2
If you need syntax highlighting, you might use some regex magic like so:
function syntaxHighlight(json) {
if (typeof json != 'string') {
json = JSON.stringify(json, undefined, 2);
}
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
var cls = 'number';
if (/^"/.test(match)) {
if (/:$/.test(match)) {
cls = 'key';
} else {
cls = 'string';
}
} else if (/true|false/.test(match)) {
cls = 'boolean';
} else if (/null/.test(match)) {
cls = 'null';
}
return '<span class="' + cls + '">' + match + '</span>';
});
}
See in action here: jsfiddle
Or a full snippet provided below:
function output(inp) {
document.body.appendChild(document.createElement('pre')).innerHTML = inp;
}
function syntaxHighlight(json) {
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
var cls = 'number';
if (/^"/.test(match)) {
if (/:$/.test(match)) {
cls = 'key';
} else {
cls = 'string';
}
} else if (/true|false/.test(match)) {
cls = 'boolean';
} else if (/null/.test(match)) {
cls = 'null';
}
return '<span class="' + cls + '">' + match + '</span>';
});
}
var obj = {a:1, 'b':'foo', c:[false,'false',null, 'null', {d:{e:1.3e5,f:'1.3e5'}}]};
var str = JSON.stringify(obj, undefined, 4);
output(str);
output(syntaxHighlight(str));
pre {outline: 1px solid #ccc; padding: 5px; margin: 5px; }
.string { color: green; }
.number { color: darkorange; }
.boolean { color: blue; }
.null { color: magenta; }
.key { color: red; }
2 of 16
441
User Pumbaa80's answer is great if you have an object you want pretty printed. If you're starting from a valid JSON string that you want to pretty printed, you need to convert it to an object first:
var jsonString = '{"some":"json"}';
var jsonPretty = JSON.stringify(JSON.parse(jsonString),null,2);
This builds a JSON object from the string, and then converts it back to a string using JSON stringify's pretty print.
Js
pretty-print-json.js.org
Pretty-Print JSON β’ Interactive online JavaScript tool to format ...
Pretty-print JSON data into HTML to indent and colorize (written in functional TypeScript)