Paste raw or minified JSON to pretty-print it instantly. Invalid JSON is flagged with the exact line and column of the problem so you can fix it fast.
How to use the JSON Formatter & Validator
- 1 Paste JSON into the input box — it is validated as you type.
- 2 Choose indentation and optionally sort keys alphabetically.
- 3 Click Format or Minify, then copy or download the result.
Worked examples
Input: {"name":"Ada","tags":["math","code"]}
Result: Indented, colour-highlighted JSON
Input: {"a": 1,}
Result: Invalid JSON at line 1
Trailing commas are not allowed in JSON
Common JSON errors
- Trailing commas —
{"a": 1,}is valid JavaScript but invalid JSON. - Single quotes — JSON strings and keys must use double quotes.
- Unquoted keys —
{name: "Ada"}must be{"name": "Ada"}. - Comments — standard JSON does not allow
//or/* */comments. - Special values —
NaN,Infinityandundefinedare not valid JSON.
Format vs. minify
Formatting adds indentation and line breaks for humans. Minifying removes all unnecessary whitespace to make payloads smaller for APIs and storage — the data is identical.
Runs locally
Everything happens in your browser — nothing you paste is uploaded or logged, so it is safe to use with API responses, tokens and internal data.
Frequently asked questions
How do I validate JSON?
Paste it into the input — the status bar shows "Valid JSON" or the exact location of the first error.
Does sorting keys change my data?
No. Object key order has no meaning in JSON, so sorting only changes presentation. Array order is preserved.
How large a file can I format?
Several megabytes work comfortably. Syntax highlighting is skipped above 1 MB to keep the page fast.
Related tools
Base64 Encoder
Encode text to Base64 (UTF-8 safe), with URL-safe and MIME line-wrapping options.
Base64 Decoder
Decode Base64 and URL-safe Base64 back to UTF-8 text, with clear errors for invalid input.
URL Encoder / Decoder
Percent-encode or decode URLs and query parameters, as a component or a full URI.
HTML Entity Encoder / Decoder
HTML entity encoder and decoder: escape special characters to entities, or decode named and numeric entities back to text.
Regex Tester
Regex tester for JavaScript regular expressions: live match highlighting, capture groups and replace preview.
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of text or files, and verify checksums.