{ }

JSON Formatter & Validator

Format, validate, and minify your JSON — with precise error locations when something breaks.

Indent
Your formatted JSON will appear here

Everything runs in your browser. Your JSON is never uploaded to a server.

JSON is the language computers use to talk to each other, and its greatest strength — a strict, unambiguous structure — is also what makes it unforgiving to read and write by hand. A single missing comma, a trailing one where it does not belong, or a mismatched bracket turns a whole document into an error, and the machine's complaint is rarely helpful about where. This tool formats messy JSON into clean, indented, readable structure; validates it and points to exactly where it breaks; and minifies it back down for transmission. Everything runs in your browser, so even sensitive API responses and config files never leave your machine.

How the tool works

Paste your JSON and the tool parses it. If it is valid, you get it back beautifully indented and readable, or minified to the smallest possible size, whichever you choose. If it is broken, the tool tells you what is wrong and where — the specific line and character — so you can fix the exact problem rather than hunting through the whole document. The parsing happens entirely in your browser; nothing you paste is uploaded, which matters because JSON often contains tokens, keys, and private data.

The rules JSON enforces

Valid JSON requires: "keys" always in double quotes "strings" double quotes only, never single no trailing comma {"a":1,} ← invalid no comments // ... ← invalid values: string, number, boolean, null, object, array Format = add indentation & line breaks (readable) Minify = strip all whitespace (small, for transfer)

JSON's strictness is the whole point and the whole frustration. Unlike JavaScript objects, which it resembles, JSON forbids single quotes, trailing commas, comments, and unquoted keys — rules people break constantly because JavaScript allows them. Formatting and minifying are the same valid data with different whitespace: indentation makes it readable for humans, and stripping whitespace makes it compact for the network, where every byte of a large payload counts. Neither changes the data, only its presentation, which is why you can freely convert back and forth.

What to know about working with JSON

  • 1The most common JSON errors are trailing commas and single quotes. JavaScript tolerates both, so developers write them by habit, but strict JSON rejects both outright. An object ending in `,}` or a string in 'single quotes' is invalid JSON even though it looks fine. When JSON fails to parse, check for these two first — they account for a large share of all errors.
  • 2Format while developing, minify before sending. Indented JSON is far easier to read and debug, so keep it formatted while you work. But for transmission — API responses, config sent over the network — minifying strips every unnecessary byte, which matters at scale where a large payload sent millions of times adds up. The two forms are the same data for different audiences: humans and machines.
  • 3The error location is your fastest path to a fix. A validator that names the line and character of the problem turns a frustrating hunt into a targeted fix. Rather than scanning a whole document for a missing bracket, jump straight to where the parser choked — the real error is usually at or just before that point, even if the symptom appears later.
  • 4JSON has no comments, and that trips people up constantly. Configuration files often want explanatory comments, but strict JSON forbids them, which is why formats like JSONC and JSON5 exist to add them back. If you need comments in a JSON-like config, you are using an extended dialect, not standard JSON — and standard parsers will reject the comments.
  • 5Watch out for JSON that has been double-encoded. A common bug is a JSON string that itself contains escaped JSON — a value like `"{\"a\":1}"` instead of a real object. This happens when data is serialized twice, and it reads as a plain string, not structured data. If a field looks like JSON wrapped in quotes with backslashes, it was encoded one time too many.

Frequently asked questions

Why is my JSON invalid when it looks correct?

Almost always a trailing comma or single quotes. JavaScript allows both — an object like `{"a": 1,}` or a string in 'single quotes' — so developers write them by habit, but strict JSON forbids both, and either makes the whole document invalid. Other frequent culprits are unquoted keys and comments, which JavaScript permits and JSON does not. When valid-looking JSON won't parse, check for a trailing comma and single quotes first; they cause a large share of errors.

What is the difference between formatting and minifying?

They are the same data with different whitespace. Formatting adds indentation and line breaks to make the JSON readable for humans, ideal while developing and debugging. Minifying strips all unnecessary whitespace to make the file as small as possible for transmission, ideal for API responses and anything sent over the network where size matters. Neither changes the actual data — you can convert freely between them, using the readable form to work and the compact form to send.

Can JSON have comments?

No — standard JSON does not allow comments of any kind, which surprises people using it for configuration files where explanatory notes would help. This is a deliberate design choice for simplicity and unambiguity. Extended dialects like JSONC (JSON with Comments) and JSON5 add comment support, but they are not standard JSON, and a strict parser will reject comments as invalid. If your config needs comments, you need one of those dialects, not plain JSON.

Why does the error appear on a different line than the real problem?

Because the parser only fails once it reaches something that cannot be valid, which is often after the actual mistake. A missing comma or unclosed bracket lets the parser continue until the structure becomes impossible, then it reports the point where it gave up — which can be lines later. The real fix is usually at or just before the reported location, so check the structure leading up to the error, not only the exact line named.

Is my JSON data sent to a server?

No. The parsing, formatting, validating, and minifying all run entirely in your browser, so your JSON is processed locally and never transmitted, logged, or stored. You can verify this by disconnecting from the internet — the tool keeps working because no server is involved. This matters because JSON frequently contains API keys, access tokens, personal data, and configuration secrets that you would not want uploaded anywhere.