JSON Formatter
Readable JSON and a clear error
JSON is easy for machines and unforgiving for people. One trailing comma, one unquoted key, one smart quote pasted from a document, and an entire API request fails. A formatter helps you see the structure, but the more useful feature is the error message that tells you where the structure broke.
Formatting is not validation
Pretty-printing adds indentation and line breaks. Minifying removes them. Neither operation proves that the JSON is valid. A formatter should parse the text first, then format the parsed value. If parsing fails, there is no valid structure to format.
That distinction matters when you paste a payload that “looks fine.” A missing comma between two objects is invisible in a wall of text and obvious once the JSON is indented.
A safe workflow
- Paste the original payload. Do not paste a value that has already been transformed by a shell command, a chat app, or a document editor. Smart quotes and ellipses are common sources of invalid JSON.
- Format first. If the tool cannot parse it, fix the reported syntax before changing anything else.
- Read the error location. A line and column are a starting point, not always the exact fault. Missing brackets often report at the end of the file.
- Minify only after validating. Minified output is for transport, not for editing.
- Do not paste production secrets. Use a local scratch value or redact tokens before pasting.
JSON Formatter parses, pretty-prints, and minifies in the browser. The text is not uploaded.
The errors people actually hit
- Trailing commas. JSON does not allow a comma after the last item in an array or object.
- Single quotes. JSON strings must use double quotes.
- Unquoted keys.
{name: "Ada"}is JavaScript object syntax, not JSON. - Comments. JSON has no comments. Remove them or use JSONC with a tool that explicitly supports it.
- Smart quotes. A word processor can turn
"into“; the bytes are different. - NaN and Infinity. JSON has no representation for them. Use
nullor a string. - A BOM or hidden character. Invisible leading bytes can break a parser.
What a formatter should not do
It should not “fix” invalid JSON silently. A tool that guesses what you meant can turn a syntax error into a valid but wrong payload. The safer behavior is to stop and report the parse failure.
It also should not upload the payload to a server. JSON often contains customer records, internal URLs, or credentials. Browser-local formatting removes that transfer.
When to use something else
If you need to transform JSON into another shape, a formatter is not enough. Use a schema-aware validator, a JSONPath tool, or code. If the payload is large, a browser textarea may become slow; use a local editor or command-line tool.
For CSV-shaped data, CSV to JSON converts rows into objects. For Markdown content, Markdown to HTML handles a different syntax.
The short version
Format, then inspect, then minify. Treat every parse error as a real error, not an inconvenience. And keep private payloads in the browser.