JSON Formatter & Validator: Beautify or Minify JSON
Paste JSON to spot syntax errors, re-indent it with 2 spaces or minify it by stripping all whitespace.
Format, validate and repair JSON: what the tool actually does
Validation relies on the browser's JSON parser (JSON.parse), which enforces the strict RFC 8259 syntax: double quotes only, no trailing comma, no comments. Beautify re-indents with 2 spaces, Minify strips all optional whitespace, and Fix attempts three automatic repairs before validating again.
Operations
- Validation: on error, the browser's message gives the failing position (for example “Expected double-quoted property name … at position 8” for a trailing comma). The tree view only appears for valid JSON.
- Beautify: JSON.stringify with a 2-space indent.
- Minify: the same serialization with no spaces or line breaks.
- Fix: replaces every single quote with a double quote, removes trailing commas before } and ], and quotes keys made of letters, digits and _.
Example
The input {name: 'Kristools', 'tags': ['finance', 'sante',], actif: true,} is invalid. After Fix and Minify it becomes {"name":"Kristools","tags":["finance","sante"],"actif":true}, 60 characters versus 86 in the indented version.
Limits
- The repair also converts apostrophes inside text, so
'it's'becomes invalid. Always review the output. - Integers above 253 lose precision when reformatted (9007199254740993 becomes 9007199254740992): store long IDs as strings.
- Duplicate keys are not flagged; only the last value survives formatting.
- Imported .json or .txt files are read in the browser; the download is saved as data.json. Size is shown in bytes (UTF-8), length in characters.
Frequently Asked Questions
Why is my JSON invalid when it works in JavaScript?
JSON is stricter than a JavaScript object: keys and strings need double quotes, and trailing commas, comments and undefined are not allowed. The validator applies the RFC 8259 syntax and reports the position of the first error.
What exactly does the automatic repair fix?
Three things: single quotes become double quotes, trailing commas before } or ] are removed, and unquoted keys (letters, digits, _) get quotes. An apostrophe inside text breaks the repair, so always review the result.
Why does a large numeric ID change after formatting?
The browser stores numbers as double-precision floats, so integers above 9,007,199,254,740,991 (2 to the power of 53 minus 1) are rounded. 9007199254740993 comes out as 9007199254740992; store such IDs as strings.
How much smaller does minification make a file?
It removes indentation and line breaks without changing the data. In the example on this page the object shrinks from 86 to 60 characters, 30% less; the saving grows with nesting depth.
Is this tool really free?
Yes, all tools on Kristools are 100% free and accessible without registration.
Is my data protected?
Yes. All processing is performed directly and securely inside your browser. No personal data is sent to our servers.