{ } JSON Formatter & Validator

Beautify, minify and validate JSON in one place — and when it breaks, see the exact line and column instead of a bare "unexpected token".

📊 Size and structure

Characters
0
Bytes (UTF-8)
0
Values
0
Max depth
0
Saved by minifying
–

Minifying removes indentation and line breaks only — spaces inside your string values are data and are kept exactly as written.

How to use the JSON formatter

Paste JSON into the top box and press Beautify to indent it, Minify to collapse it to a single line, or Validate to check the syntax without changing anything. If the document is broken, the status bar names the error and points at the line and column so you can jump straight to it. Ctrl+Enter formats without reaching for the mouse.

What makes JSON valid — and what quietly breaks it

JSON has six value types: object, array, string, number, boolean and null. That is the whole language. It looks like JavaScript, which is exactly why hand-written JSON fails so often: the habits that are legal in JavaScript are not legal in JSON.

What you wroteValid?Why
{'name':'Ada'}❌ NoSingle quotes — JSON requires double quotes around keys and strings
{"name":"Ada",}❌ NoTrailing comma after the last member
{"count":01}❌ NoLeading zeros are not allowed in numbers
{"ok":undefined}❌ Noundefined is not a JSON value — use null or omit the key
{"a":1 /* note */}❌ NoJSON has no comments
{"name":"Ada","count":1}✅ YesDouble quotes, no trailing comma
{"path":"C:\\temp"}✅ YesA backslash must itself be escaped as \\

How the error position is calculated

Browsers report a parse failure as a character offset from the start of the document, not a line number. This tool walks the text up to that offset, counts newlines, and converts the offset into a 1-based line and column, then prints the offending line with a caret underneath. On a 2,000-line config file that turns a hunt into a single glance.

When to reach for it

Reading an API response that arrives as one enormous line, checking a webhook payload before you trust it, repairing a config file someone edited by hand, comparing two versions of a document after sorting keys alphabetically, or shrinking a payload you are about to paste into a form with a size limit.

Assumptions and limitations

This is a syntax check, not a schema check. Valid JSON can still be wrong data: a misspelled field, a date in the wrong format, a number where a string was expected. Nothing is uploaded — parsing happens with the browser's own JSON.parse, so the document never leaves your device. Very large files (tens of megabytes) can stall the tab; split them first. Duplicate keys are accepted and the last one wins, which matches most parsers but silently hides a real bug.

Frequently Asked Questions

Why does JSON reject single quotes and trailing commas?

Because JSON was specified as a strict, unambiguous interchange format, not as a JavaScript literal. The RFC 8259 grammar allows only double-quoted strings, and it defines an object as a member followed by zero or more comma-plus-member pairs — so a comma may never be last. Every mainstream parser enforces both rules, which is why a file that looks fine in an editor can still fail on the server.

What is the difference between JSON and a JavaScript object?

JSON is text with a fixed grammar; a JavaScript object is a live value in memory. Several things that exist in JavaScript have no JSON representation: functions, undefined, symbols, comments, and dates (a Date becomes an ISO string). Converting with JSON.stringify silently drops function and undefined properties, and turns NaN and Infinity into null — a common source of "my field disappeared" bugs.

Does formatting change what the data means?

No. Whitespace between tokens is insignificant, so a beautified document and its minified twin parse to exactly the same value. Whitespace inside a string is different — it is part of the value, and neither Beautify nor Minify touches it. That is also why minifying typically saves 20–40% on indented data rather than the 60% people expect.

Is my JSON uploaded anywhere?

No. The entire tool runs in your browser using the built-in JSON.parse and JSON.stringify. There is no network request carrying your document, so it is safe for API responses containing tokens, customer records, or anything covered by an NDA. You can verify this by opening the network panel of your browser's developer tools while formatting.

🛒 Recommended for You

As an Amazon Associate, Benditools earns from qualifying purchases.