Toolcin

JSON formatter and validator

Formatting only changes whitespace. Validation parses the document and reports the first position where it stops being valid JSON โ€” a line number and a character offset, which is what you actually need.

Open the JSON Formatter tool

These are two different jobs wearing one name. A formatter adds indentation so a human can read it. A validator parses it and tells you whether any program can read it. A file can be perfectly formatted and still invalid.

The five errors that break JSON

MistakeExampleWhy it happens
Trailing comma{"a":1,}Legal in JavaScript objects, not in JSON
Single quotes{'a':1}Legal in Python and JS, not in JSON
Comments// noteJSON has no comment syntax at all
Unquoted keys{a:1}JavaScript object literal habit
NaN or Infinity{"x":NaN}Not representable in JSON numbers

Every one of these is accepted by a JavaScript console and rejected by a strict parser. That gap is why a test passes in the browser and the API returns 400.

Read the error position, not the message

A parser reports the first place it gave up, which is often one character after the real problem. Unexpected token } at line 40 usually means line 39 ended with a comma. Fix, re-validate, repeat: JSON errors surface one at a time, so a file with five problems takes five rounds unless you read carefully.

Formatting choices that matter

Big files

A 40 MB response will make a browser tab struggle if the formatter builds a full DOM tree for it. If a tool freezes, the practical approach is to validate first, then format only the section you are debugging โ€” or pipe it through a command-line tool where memory is not the constraint.

Do not paste secrets

Real API responses carry bearer tokens, session ids and personal data. Formatting in the browser keeps the text local, but the copy on your clipboard is still a credential. Replace values with placeholders before that JSON goes into a ticket, a chat or a screenshot.

Questions

Does formatting change the data?

No. Indentation is whitespace between tokens; the parsed values are identical. Key order is preserved when formatting, though JSON itself does not guarantee it.

Why does my JSON work in JavaScript but fail validation?

Because JavaScript object literals are more permissive than JSON: unquoted keys, single quotes and trailing commas are all allowed there and rejected here.

Can JSON have comments?

Not in the standard. JSON5 and JSONC allow them, and some config files use those dialects. A strict parser will reject both.

Is my JSON uploaded?

No. Formatting and validation happen in the browser tab.

Updated 2026-11-16 ยท written for this site, no trackers, no account.