Format and validate JSON
Paste JSON and get it back indented and syntax-highlighted. If it is invalid, you get the parser's exact complaint and where it happened, which is the part you actually needed.
Key facts
-
Under RFC 8259, any JSON value is a complete JSON text —
42,"hello",trueandnullare each valid documents, not just objects and arrays. source - RFC 8259 says object names SHOULD be unique — not MUST. Documents with duplicate keys parse successfully, and most implementations silently keep the last value. source
- JSON exchanged between systems outside a closed ecosystem must be encoded in UTF-8, which is why a file saved as Latin-1 fails with a malformed-UTF-8 error rather than a syntax error. source
- JSON has no comments, no trailing commas, and no single-quoted strings — all three are legal JavaScript, which is why valid-looking documents fail to parse. source
It tells you where it broke
Most of the time you are not here to make JSON pretty — you are here because something rejected it and you want to know why. So when the input does not parse, this reports the specific error (Syntax error, Control character error, Malformed UTF-8) rather than a generic "invalid JSON", and it does not silently repair anything.
Valid input is re-emitted with two-space indentation, slashes left unescaped and Unicode left as-is, so a URL stays readable and an accented name stays an accented name instead of becoming é.
The usual culprits
If it will not parse, it is almost always one of these — none of which are legal JSON, however normal they look in JavaScript:
- A trailing comma after the last element of an object or array.
- Single quotes around strings or keys. JSON requires double quotes.
- Unquoted keys — legal in a JavaScript object literal, not in JSON.
- Comments. JSON has none, whatever your editor lets you type.
-
NaN,Infinityorundefined— all JavaScript values with no JSON representation.
Valid is not the same as correct
A parser only answers one question: is this syntactically legal JSON? It has no opinion on whether the structure is the one your API expects. So a payload can format perfectly here and still be rejected downstream — because a field is missing, a value is a string where a number was expected, or a key is spelled differently from the schema.
A few things are legal JSON that people assume are not, which is worth knowing before you go hunting for a syntax error that is not there. Duplicate keys parse — RFC 8259 says names should be unique, not must, and most parsers quietly keep the last one. A bare value like 42 or "hello" is a complete JSON text on its own; it does not need to be wrapped in an object. And an empty object or array is valid, so {} parsing fine tells you nothing about whether your data made it in.
Reading a parser error message
The error names a symptom; the cause is usually a line or two earlier:
- Syntax error — the parser reached something it could not fit into the grammar. The real fault is typically the previous token: an unclosed string, a missing comma, or one bracket too few.
-
Control character error — a raw newline or tab inside a string literal. It must be escaped as
\nor\t. This is what a log line pasted straight into a JSON value produces. - Malformed UTF-8 — the bytes are not valid UTF-8, usually because the file was saved as Latin-1 or a copy-paste lost an encoding.
- Depth limit exceeded — genuinely deep nesting, or more often a runaway generator that never closed its brackets.
- Unexpected end of input — the document was truncated. Check whether it was cut off mid-transfer rather than hunting for a typo.
If the JSON is coming from a spreadsheet
A PasteSheet endpoint serves a Google Sheet as JSON that is valid by construction — you never hand-edit it, so it never develops a trailing comma. Convert a sheet to JSON to see the shape it produces.
Frequently asked questions
Why is my JSON invalid when it looks fine?
Usually a trailing comma, single quotes instead of double quotes, an unquoted key, or a comment. All four are perfectly normal JavaScript and none of them are legal JSON, which is exactly why they are so easy to miss when you are reading the file.
Does it change my data?
No. It re-indents valid JSON and returns it. Nothing is reordered, no keys are renamed, no values are coerced, and nothing is auto-repaired — if the input will not parse, you get the error rather than a guess at what you meant.
Is my JSON stored or logged?
No. It is parsed, formatted and returned. Nothing is written to a database, logged or shared. As with any online formatter, if the payload contains secrets or personal data, do not paste it in the first place.
Are duplicate keys invalid JSON?
No. RFC 8259 says object names should be unique, not that they must be, so a document with duplicates parses. Most parsers keep the last occurrence and discard the earlier ones silently, which makes it a nasty source of bugs rather than a syntax error.
Can a JSON document be just a number or a string?
Yes. Since RFC 8259, any JSON value is a complete JSON text — 42, "hello", true, and null are all valid documents on their own. It does not have to be wrapped in an object or array.
What does "control character error" mean?
A raw newline, tab, or similar control character appears inside a string literal, where it must be escaped as \n or \t. Pasting a multi-line log message directly into a JSON value is the usual cause.
Does formatting sort or reorder my keys?
No. Key order is preserved exactly as parsed. Only whitespace changes, so a diff against the original shows indentation and nothing else.
My JSON is valid but the API still rejects it. Why?
Validity is a syntax question, not a schema one. A syntactically perfect document can still be missing a required field, use a string where a number is expected, or misspell a key. Check the API's schema, not the parser.
Sources
Related tools
Free CSV to JSON Converter Online
Paste CSV and get formatted JSON back — one object per row, keyed by the header row. Quoted fields, embedded commas and newlines all handled. Free, no signup.
Free JSON to CSV Converter Online
Paste a JSON array of objects and get CSV back, header row built from the keys. Values holding commas or quotes are escaped properly. Free, no signup.
Free Google Sheets to JSON Converter
Paste a public Google Sheet URL and get clean, formatted JSON instantly. No signup, no API key, and no Google Cloud project. Copy it, download it, or go live.
Turn your sheet into an API in minutes
Paste a Google Sheet URL and get a live REST API and MCP server — no backend, no code, free to start.