JSON Formatter & Validator - Free, Local
Paste JSON to format it with indentation, minify it to a single line, or check it's valid. Invalid JSON is flagged with the exact position of the problem, entirely in your browser.
Maintained by Hirantha Sandaruwan Lakshan. Updated 31 July 2026.
How it works
The text is parsed with the browser's built-in JSON parser. If parsing fails, the error message and character position are shown directly rather than a generic 'invalid JSON' notice.
Formatting re-serialises the parsed result with two-space indentation, producing consistent output regardless of how the original was spaced or minified.
Minifying does the same parse-and-reserialise step with no indentation, useful for pasting JSON into a context where whitespace costs bytes, like a URL parameter or a compact config file.
Worked examples
Reading a minified API response
Paste a single-line JSON response from an API call and format it to see the structure clearly, with nesting indented.
Checking a config file is valid before committing
Paste a JSON config and get an immediate answer on whether it parses, with the exact location of a trailing comma or missing quote.
Shrinking JSON before embedding it somewhere
Minify a formatted JSON blob down to one line before pasting it into a place where every character counts.
Frequently asked questions
Is my JSON uploaded anywhere?
No, parsing and formatting both happen entirely in your browser tab.
What happens if my JSON is invalid?
The parser's error message is shown along with the position in the text where it failed, rather than a vague failure notice.
Does this support JSON with comments?
No - standard JSON doesn't allow comments, so a file with them will fail to parse here, matching how most JSON consumers behave.
Is there a size limit?
No fixed limit - very large documents are bound only by your browser's available memory.
Can it minify JSON as well as format it?
Yes, minifying strips all the whitespace back out to give the smallest valid representation, which is what you'd send over the network.
Does it sort keys alphabetically?
No. Key order is preserved exactly as written, because reordering would change the file in a way that isn't always safe or wanted.
Why does it reject my JSON when it looks fine?
The usual culprits are trailing commas after the last item, single quotes instead of double quotes, or unquoted keys. All three are valid JavaScript but not valid JSON.
Can it handle very large JSON files?
Large documents work, but parsing and re-rendering many megabytes of JSON will make the browser sluggish. It's built for the payloads you're debugging, not for bulk data processing.
Sources & references
Updated Jul 31, 2026