JSON Formatter

Format, validate, and beautify JSON — or minify it — in seconds.

← All tools

Short answer: Paste any JSON to validate it and pinpoint exactly where syntax errors are, or format it with clean indentation in one click. The Minify button compresses JSON to a single line for smaller network payloads. Everything runs locally in your browser — your data is never uploaded.

Last updated: October 13, 2026

Runs entirely in your browser — nothing you paste is uploaded or stored.

How it works

Paste or type JSON into the box and the tool checks it as you type. Choose Format JSON to pretty-print the data with two-space indentation, or Minify to strip the whitespace back out for a compact payload. The result replaces the input, ready to copy.

  1. Paste your JSON into the input box — a sample is already loaded.
  2. Watch the status line: it tells you right away whether the JSON is valid.
  3. Format or minify, then use Copy result to grab the output.

Validation uses the strict JSON parser built into your browser, so if your data passes here it will parse in any other tool, API client, or programming language.

A worked example

The sample loaded in the tool above is a single compact line:

{"name":"Ada Lovelace","role":"Software Engineer","skills":["math","poetry","computing"],"active":true,"projects":3}

One click on Format JSON turns it into indented, readable output with every key on its own line — the version you would paste into documentation, a code review, or a config file.

Frequently asked questions

Is my JSON uploaded or stored anywhere?

No. Parsing and formatting happen with the JSON engine built into your browser, on your own device. Nothing you paste is sent to a server or saved.

Why does it say my JSON is invalid?

The usual causes are trailing commas, single quotes instead of double quotes, unquoted property names, or comments inside the data. The status message describes the exact problem the parser found.

What is the difference between formatting and minifying?

Formatting adds indentation and line breaks so people can read the structure. Minifying removes all optional whitespace, producing the smallest possible payload for APIs and storage.

Can I format very large JSON files?

Yes, within your device memory. Because everything runs locally, large documents may take a moment, but there is no file-size limit imposed by a server.

Does formatting change my data?

No. Values, key order, and structure stay exactly the same — only whitespace changes. Minify and Format are exact inverses.

Why doesn't JSON allow trailing commas?

The JSON grammar simply does not include them — it was designed for unambiguous machine parsing, and trailing commas were judged a source of errors rather than convenience. JavaScript object literals allow them; JSON, strictly, does not.

Can JSON contain comments?

No. Neither // nor /* */ comments are valid JSON. If your source has comments (for example, a config file in JSONC format), strip them before validating — or the parser will fail on the first slash.

What is the difference between JSON and a JavaScript object?

JSON is a text format with strict rules: double-quoted keys and strings, no functions, no trailing commas. A JavaScript object literal is code, and allows unquoted keys, single quotes, trailing commas, and methods. Valid JSON is valid JavaScript, but not the other way around.

How do I fix an "Unexpected token" error?

Look at the reported position, then scan just before it: the real mistake — a missing quote, comma, or bracket — is usually on the preceding line. Fix the first error and re-validate, because one slip often produces a cascade of follow-on errors.

What counts as valid JSON

JSON looks forgiving, but its grammar is strict. Object keys and all strings must use double quotes — single quotes are not valid. Numbers, true, false, and null stand alone without quotes. Commas separate items, never trail them, and comments are not allowed anywhere in the document. A surprising amount of "broken API responses" turn out to be JavaScript object literals pasted into a JSON context, where unquoted keys and trailing commas are legal but JSON rejects them.

The five mistakes that break JSON most often

1. Trailing commas. {"a": 1,} is invalid — remove the comma before the closing brace or bracket. 2. Single-quoted strings. {'a': 1} must become {"a": 1}. 3. Unquoted keys. {a: 1} needs quotes around a. 4. Comments. Neither // nor /* */ may appear; strip them before validating. 5. A missing comma or bracket somewhere in the middle, which usually produces an error pointing a line or two after the actual mistake.

Broken: {"name": "Ada", "scores": [10, 20,], }
Fixed: {"name": "Ada", "scores": [10, 20]}

When validation fails, the tool reports where the parser gave up — typically the line and character position. Because one missing bracket can cascade, the practical technique is to fix the first reported error and re-validate; later errors often vanish on their own. Formatting changes nothing about the data's meaning: pretty-printed and minified JSON describe exactly the same values, so choose readable indentation while editing and compact output when every byte of a payload matters.

How do I find and fix JSON syntax errors?

Three errors cause nearly every failure: trailing commas after the last item in an object or array, unquoted or single-quoted keys and strings, and mismatched brackets. Paste the suspect JSON here and the validator flags the exact position of the first problem — fix that one and revalidate, because a single early error can cascade into misleading messages further down.

Copying JSON out of JavaScript code or documentation is the usual source; both allow syntax that strict JSON forbids, like comments and trailing commas.

Should I beautify or minify my JSON?

Beautify when a human needs to read it — debugging an API response, reviewing a config file, or learning a data structure. The indentation makes nesting visible at a glance.

Minify when a machine consumes it: collapsing whitespace shrinks payloads, which means faster transfers and lower bandwidth bills. Never hand-edit minified JSON; beautify it first, make your change, then minify again if needed.

Embed this tool

Put this free json formatter on your own website or blog. Copy the code below and paste it into any page that accepts HTML — readers get the full working tool without leaving your site.

Powered by DailyToolHub

Related tools