JSON is everywhere: API responses, config files, export dumps, and webhook payloads. It is easy for machines to read but painful for people when it arrives as one long, unbroken line. This guide shows how to format and validate JSON quickly, and how to fix the handful of mistakes that cause most “invalid JSON” errors.
Format JSON in three steps
- Open the JSON Formatter & Validator and paste your JSON into the input area.
- Pick an indent style (2 spaces, 4 spaces, or tab) and click Beautify. The output is indented and syntax-highlighted so the structure is clear.
- Click Copy to grab the result. If you need the smallest possible size for storage or transfer, click Minify instead.
Everything runs in your browser. Your data is never uploaded, which matters when the JSON contains tokens, customer records, or anything else you would not paste into a random website.
Beautify vs minify
These are two sides of the same coin:
- Beautify adds indentation and line breaks so a human can read the structure. Use it while debugging an API response or reviewing a config file.
- Minify strips every unnecessary space and newline to produce the smallest valid JSON. Use it for production config, caching, or anywhere bytes matter.
The data is identical either way. Only the whitespace changes.
Fixing the errors that break JSON
When a formatter says your JSON is invalid, it is almost always one of these:
- Trailing commas.
{"a": 1,}is valid in JavaScript but not in JSON. Remove the comma after the last item. - Single quotes. JSON requires double quotes for both keys and string values.
{'a': 'b'}must be{"a": "b"}. - Unquoted keys.
{a: 1}is a JavaScript object, not JSON. Keys must be quoted:{"a": 1}. - Comments. JSON has no comments. Remove any
//or/* */before parsing. - Wrong brackets. An object uses
{}and an array uses[]. Mixing them, or leaving one unclosed, will fail.
A good validator points to the line and column of the first error, so you can jump straight to the problem instead of hunting through hundreds of lines.
A quick tip for large files
Because the formatting happens on your own device, the practical size limit is your browser’s memory, not a server upload cap. Very large files still work; they just take a moment to render. If you only need to inspect part of a huge payload, paste the relevant section rather than the whole thing.
Related tools
- Working with YAML config too? Convert between formats with the YAML to JSON Converter.
- Need to decode a token from an API? Try the JWT Decoder.
- Encoding a payload for a URL or header? Use Base64 Encode / Decode.
Formatting JSON should take seconds and keep your data private. Paste, beautify, validate, and copy, all without leaving your browser.