JSON Formatter
Pretty-print, minify, or sort-key JavaScript Object Notation (JSON).
Monitor this automatically
NetTests can run this check on a schedule, preserve historical results, compare changes over time, and alert you the moment something breaks.
Start monitoring free → See all monitoring productsFrequently Asked Questions
What does this tool do?
It parses JavaScript Object Notation (JSON) text and lets you pretty-print it with indentation (making it human-readable), minify it (removing all whitespace for smaller payloads), or sort all object keys alphabetically (useful for diffing two JSON objects).
Why is my JSON invalid?
Common causes: trailing commas after the last item in an object or array (not allowed in JavaScript Object Notation (JSON), only in JavaScript); single-quoted strings (JSON requires double quotes); unquoted keys; comments (JSON has no comment syntax); or a missing closing bracket or brace. The error message will point to the approximate location.
What is the difference between JSON and JavaScript objects?
JavaScript Object Notation (JSON) is a strict text format — all keys must be double-quoted, no trailing commas, no comments, no undefined, no functions. JavaScript object literal syntax is more lenient. JSON is language-independent; JavaScript can parse it with JSON.parse() and produce it with JSON.stringify().
When should I minify vs pretty-print JSON?
Pretty-print for reading, debugging, and version control (diffs are easier to read). Minify for production Application Programming Interface (API) responses and file storage where you want smaller payloads. Minifying a large JavaScript Object Notation (JSON) file can reduce its size by 20–40 %.