JSON Beautifier and Validator With Error Details
Format, validate, and minify JSON, with your browser's own error message when something is wrong.
About JSON Formatter & Validator
JSON Formatter & Validator takes a block of JSON, checks that it is valid, and rewrites it in one of two shapes. Format spreads it over many lines with two spaces of indentation, while Minify packs it onto a single line with no optional whitespace. The result replaces the text in the same box, so there is only one field to work with.
People reach for it to read an API response that arrived as one long line, to tidy a settings or package file before saving it, to inspect a webhook from a payment or courier service they are integrating for a client, or to hunt down the stray comma that stops a file loading.
Validation is done by the browser's own JSON parser, which is strict. Comments, trailing commas, single quotes and unquoted keys are all rejected, and the wording of the error comes from your browser, so it can differ between Chrome, Firefox and Safari. Indentation is fixed at two spaces; there is no option to sort keys or open a file.
How to use JSON Formatter & Validator
- Paste your JSON into the large box that says "Paste your JSON here...", or type it in directly.
- Click Format to validate the text and re-indent it with two spaces per level, or click Minify to strip the optional whitespace.
- Read the message beside the buttons. It says "Formatted successfully." or "Minified successfully.", or it starts with "Invalid JSON:" followed by the parser's explanation.
- If there is an error, use the position or line and column in the message to find the mistake, fix it, and click Format again.
- Click Copy to put the box contents on your clipboard, or Clear to empty it and start again.
Tips for best results
- Format and Minify rewrite the parsed data, not your original characters. A value written as 1.0 becomes 1, 1e3 becomes 1000, and escapes such as \u00e9 turn into the real letter.
- Integers longer than about 15 or 16 digits, such as long transaction or account IDs, are rounded because JavaScript stores numbers as doubles. Wrap an ID in quotes if every digit must survive.
- Keys that are whole numbers ("1", "2") are moved to the front in ascending order, and when a key appears twice only the last value is kept. Compare against the original if order or duplicates matter.
- A bare string, number, true, false or null counts as valid JSON. Comments, single quotes and trailing commas do not, and the tool will not guess what you meant.
- Formatting overwrites your pasted text and there is no undo button, so keep a separate copy of anything you cannot recreate. Copy always sends whatever is in the box, valid or not.
Frequently asked questions
Is my JSON data uploaded anywhere?
No. Formatting and validation run entirely client-side in your browser; nothing is transmitted to any server.
What happens if my JSON is invalid?
The tool shows your browser's own JSON parser error message, which in current browsers usually points to the position of the problem, so you can locate and fix it.
Can I minify JSON instead of formatting it?
Yes, use the Minify button to collapse formatted JSON into a single compact line.
Can I change the indentation to four spaces or tabs?
No. Format always indents with two spaces per level. Paste the result into your editor if you need four spaces or tabs.
Why does my editor accept this JSON but the tool says it is invalid?
Some editors and config formats allow comments, trailing commas or single quotes (often called JSONC or JSON5). This tool uses the strict standard parser built into your browser, so remove those extras before formatting.
Does formatting change the order of my keys?
Keys keep their original order, except keys that are whole numbers, which JavaScript moves to the front in ascending order. Nothing is sorted alphabetically.
Is there a size limit?
The tool sets none. Very large documents depend on your device's memory, and tens of megabytes of text can make the tab slow because the page parses everything itself.