How it works
Paste JSON from an API response, log line or config file and get it back neatly indented, or squeezed onto one line for transport. The formatter parses your input with the browser's own strict JSON parser, so if it formats here, any standards-compliant program will accept it.
When the input is not valid, you get the line and column of the first problem and the characters around it. The usual culprits are trailing commas after the last item, single quotes instead of double quotes, unquoted keys, comments, and missing commas between items — all fine in JavaScript, none allowed in JSON.
Sorting keys makes two JSON documents easier to compare, because the same data always prints in the same order. The statistics show the total number of keys at every level and how deeply objects and arrays are nested.
Your JSON never leaves your device: parsing and formatting run locally in your browser, which makes the tool safe for tokens, customer records and internal configs.
Frequently asked questions
Why is my JSON invalid when it works in JavaScript?
JSON is a strict subset of JavaScript object syntax. Keys and strings must use double quotes, trailing commas are forbidden, and comments, undefined, NaN and functions are not allowed.
Does formatting change my data?
No, with one caveat: integers larger than 2^53 (about 9 quadrillion) lose precision in JavaScript, so very long numeric IDs may be rounded. Store such IDs as strings.
Is 2-space or 4-space indentation better?
It is a style choice. Two spaces is the common default for JavaScript projects and keeps deep structures readable; four spaces is popular in Python and Java codebases.