Skip to content
CleanGlyph home

JSON Formatter & Validator Online

Validate, pretty-print or minify JSON instantly. Choose 2 spaces, 4 spaces or tabs, see clear syntax errors, and keep every number, escape and key exactly as written. Free, private and browser-based.

Your text never leaves your browser.

0 charactersAnalyzed as you type

Formatted JSON

Paste JSON to validate, format or minify it instantly.

JSON formatting options

Output format
Indentation

How to format and validate JSON online

Paste JSON into the input, or load the sample. The tool validates it as you type and shows Valid JSON or Invalid JSON in the summary. Keep Pretty Print selected for readable output with 2 spaces, 4 spaces or tabs, or switch to Minify for compact output. Copy the result, or send it back to the input with Use as input. It works well for API responses, webhook payloads, configuration files, readable test fixtures and code examples, and for tracking down why a payload is rejected.

What JSON formatting and pretty printing do

JSON ignores whitespace between tokens, so the same data can be written on one line or spread over many. Pretty printing puts each value on its own line, indents nested objects and arrays, and adds one space after each colon. Empty {} and [] stay compact.

Input
{"name":"Ana","items":[1,true,null]}
Pretty Print, 2 spaces
{
  "name": "Ana",
  "items": [
    1,
    true,
    null
  ]
}

Pretty Print vs Minify

Pretty Print is for people: reviewing an API response, writing documentation or diffing two payloads. Minify is for machines: it removes every space, tab and line break outside strings so the JSON is as short as possible for storage, environment variables or request bodies. Whitespace inside string values is data and is never removed.

Input
{ "name" : "Ana" , "note" : "a  b" }
Minify
{"name":"Ana","note":"a  b"}

Common JSON syntax errors

This tool validates strict standard JSON (RFC 8259) using your browser's built-in parser and shows its error message. Invalid input is never repaired automatically, because guessing could silently change your data. These are the mistakes that come up most often, usually from hand-edited config or JavaScript object literals:

Common invalid JSON and the corrected version
ProblemInvalidValid
Trailing comma{"a":1,}{"a":1}
Single quotes{'a':'x'}{"a":"x"}
Unquoted key{a:1}{"a":1}
Comment{"a":1 /* id */}{"a":1}
Non-JSON literal{"a":NaN}{"a":null}
Missing bracket[1,2[1,2]

Raw tabs or line breaks inside a string, invalid escapes such as \x41, and the literals undefined and Infinity are rejected too. Hidden characters like non-breaking spaces between tokens also break parsing; the Text Cleaner can remove them.

Working with Unicode, escaped characters and large numbers

Strings can hold any Unicode text, including accents and emoji, written literally ("Zoë 📦") or as escapes ("Zo\u00eb"). Both forms are kept exactly as you wrote them, as are escaped slashes like https:\/\/example.com. Numbers are copied character for character, so 9007199254740993, which is beyond JavaScript's safe integer range, 1.00 and 1e+3 are never rounded or rewritten.

Minified output identical to the input
{"id":9007199254740993,"value":1e+3,"price":1.00}

Why source-preserving formatting matters

Many formatters parse JSON into JavaScript values and then serialize it again. That round trip can quietly change data: large integers lose precision (9007199254740993 becomes 9007199254740992), 1.00 becomes 1, escapes are decoded, and when a key appears twice only the last one survives. This tool uses the parser only to check validity, then reformats your original text, changing nothing but the whitespace between tokens. Repeated keys such as {"status":"old","status":"new"} are kept in order. To confirm that two versions differ only in whitespace, compare them with the Text Difference Checker.

Input is limited to 1,000,000 characters (UTF-16 code units) to keep your browser responsive. Larger input is never truncated; the tool simply asks you to shorten it. Pretty-printed output is limited to 5,000,000 UTF-16 code units to bound indentation expansion from deep nesting. If it exceeds that limit, use Minify or reduce nesting or indentation.

Check required fields, types and constraints with the JSON Schema Validator, decode and inspect tokens with the JWT Decoder & Claims Inspector, decode Base64 payloads with the Base64 Encoder & Decoder, decode JSON passed in query strings with the URL Encoder & Decoder, escape JSON for HTML source with the HTML Entity Encoder & Decoder, compare two payloads with the Text Difference Checker, or tidy copied text with the Text Cleaner.

Frequently asked questions

How do I format JSON online?

Paste your JSON into the input. Keep Pretty Print selected and choose 2 spaces, 4 spaces or tabs for indentation. The formatted result appears instantly and you can copy it or use it as new input.

How do I check if JSON is valid?

Paste it into the input. The summary shows Valid JSON or Invalid JSON as you type, and invalid input shows the browser parser’s syntax error so you can find and fix the problem.

How do I minify JSON?

Select Minify in the options panel. All whitespace outside strings is removed, producing compact single-line JSON. Spaces inside string values are kept.

Why is my JSON invalid?

The most common causes are trailing commas, single-quoted strings, unquoted keys, comments, missing commas or brackets, and literals such as undefined, NaN or Infinity, which are not part of standard JSON. The tool does not repair input automatically; correct it and the result updates immediately.

Does formatting JSON change its data?

No. This formatter only changes insignificant whitespace between tokens. Numbers such as 9007199254740993 or 1.00, escape sequences such as \u00e9 or \/, key order and repeated keys are all kept exactly as written.

Does this tool support Unicode and emoji?

Yes. Accented letters, non-Latin scripts and emoji inside strings are preserved exactly, and escaped forms such as \u2764 stay escaped rather than being converted.

Can JSON contain comments or trailing commas?

Not in standard JSON. Comments and trailing commas are allowed in variants such as JSON5 or JSONC, but this tool validates strict JSON (RFC 8259) and reports them as syntax errors.

Is my JSON uploaded or stored?

No. Validation and formatting run entirely in your browser. Your JSON is never sent to a server, saved, logged or placed in the URL.