TEXT TOOL

JSON Formatter & Minifier

Format, validate, minify, and pretty-print JSON.

LOCAL PARSING

Format JSON in your browser

Browser-only

JSON formatter guide

JSON (JavaScript Object Notation) is the lingua franca of APIs — the format nearly every web service uses to exchange data. But machine-generated JSON is often minified into a single unreadable line. This formatter turns that wall of text into structured, color-highlighted output you can actually read.

It also validates your JSON as it goes: if something is malformed, you get the exact parse error. Everything runs locally — your data never leaves the browser.

Why JSON gets minified in the first place

APIs and databases do not care about whitespace, so producers strip it out: one line, no indentation, minimum bytes on the wire. A few hundred kilobytes of formatted JSON can shrink by 30–50% when minified, which matters for mobile connections and API rate limits.

The downside is readability. A minified API response with nested objects is effectively unreadable by humans — which is where formatting (also called pretty-printing or beautifying) comes in.

Common JSON mistakes and how to spot them

  • Trailing commas — {"a":1,} is invalid. JSON does not allow a comma after the last item.
  • Single quotes — JSON requires double quotes for keys and strings. {'a': 1} fails.
  • Comments — JSON has no comments. Stripping them is required before parsing (JSON5 and JSONC exist for this).
  • Missing quotes on keys — {a: 1} is JavaScript, not JSON.
  • Trailing garbage — multiple objects back-to-back without commas, or stray characters after the closing brace.

JSON vs JavaScript objects

JSON looks like JavaScript, but it is stricter: keys must be double-quoted, no functions or undefined, no comments, no trailing commas. The two are close enough that people paste JavaScript object literals into formatters and wonder why they fail.

If you are writing configuration by hand, consider JSON5 or YAML for the convenience; if you are working with APIs, JSON is the standard you will parse.

Using this tool in your workflow

Paste an API response, click Format, and read the structure. When building an API client, minify your request bodies before sending to keep payloads small. When debugging, formatted output with line numbers makes it trivial to find the offending field.

The highlighted output distinguishes keys, strings, numbers, booleans, and null at a glance — a genuine time-saver when you are staring at a 2,000-line config file.

Frequently asked questions

What is JSON formatting?

Pretty-printing: adding indentation, line breaks, and color highlighting to minified JSON so humans can read its structure. The data itself is unchanged.

What does "invalid JSON" mean?

The text does not conform to the JSON grammar — a missing comma, unquoted key, trailing comma, or stray character. The error message points to the location of the problem.

Does formatting change the data?

No. Formatting only changes whitespace. Formatting then minifying (or vice versa) returns the exact same data.

Can JSON contain comments?

Standard JSON cannot. Some variants (JSON5, JSONC) allow them, but they must be stripped before the data is parsed by a standard JSON parser.

Is my JSON uploaded anywhere?

No. Parsing and formatting happen entirely in your browser. Your data never leaves your device.

What is the difference between JSON and YAML?

YAML is a more human-friendly superset that supports comments and many data types, but parsing is more complex and error-prone. JSON is simpler, stricter, and universal.

Privacy note: JSON parsing, formatting, and copying happen in your browser. Your data is not uploaded to NAB Tools.