JSON Formatter
Paste JSON to beautify, minify or validate it. Errors show the line and column. Your data stays in your browser.
How to use the JSON formatter
Paste JSON into the input box and choose an output: 2 spaces, 4 spaces, tab or minify. The result appears immediately and can be copied. If the JSON is invalid, the tool shows what is wrong with the line and column where parsing stopped. Turn on “Sort keys” to order object properties alphabetically at every level, which helps when comparing two documents.
What counts as valid JSON
The checker follows RFC 8259:
- Strings and property names use double quotes.
- Values are objects, arrays, strings, numbers,
true,falseornull. - Commas separate members and elements, with no trailing comma.
- Comments are not allowed.
- Any value may be the top-level text, so
42and"text"are valid documents.
Worked example
The input {"name":"Ada","tags":["math","code"]} formats with 2 spaces to a block where each property sits on its own line and the array items are indented one more level. Minifying the formatted result gives back the original single line.
If you paste {"a":1,}, the tool reports an error at line 1, column 8, because a comma is followed by the closing brace.
Limits
- Input is capped at 5,000,000 characters and 512 levels of nesting, so the page stays responsive.
- Sorting keys uses plain code unit order, so uppercase letters come before lowercase ones.
- Duplicate keys in an object are kept as written. Many parsers silently keep only the last one, so check them in your own code.
- The tool formats and checks syntax. It does not validate data against a schema.
Frequently asked questions
Why does the formatter say my JSON is invalid when it works in my code?
JavaScript object literals allow single quotes, unquoted keys, comments and trailing commas. JSON allows none of these. Property names and strings need double quotes, and no comma may follow the last item.
Are large numbers changed when I format them?
No. Numbers are kept exactly as you wrote them, including integers beyond 2^53 (9007199254740992). A tool built on JSON.parse would round them, but this formatter does not rewrite number text.
Is my JSON uploaded anywhere?
No. Parsing and formatting happen in your browser, and the text is never sent to a server.
Sources and methodology
Last reviewed 2026-12-04