JSON Formatter & Validator

Beautify or minify JSON and see exactly where a syntax error is.

0 characters
Action
Indent
Keys

What this tool checks

JSON looks like JavaScript but is stricter: keys must be double-quoted, trailing commas are not allowed, and values are limited to strings, numbers, booleans, null, objects and arrays. A single misplaced comma or a stray single-quote is enough to break a whole payload, and the resulting error from most languages' JSON parsers only gives a byte offset. This tool converts that into a line and column you can actually find, and beautifies valid JSON so nested structures are easy to read.

Minifying does the opposite: it strips every non-significant space and newline, which is what you want before sending JSON over the wire or pasting it into a field with a size limit.

Example

Paste a compact object:

{"name":"Ada","born":1815,"tags":["math","writer"]}

and Format produces:

{
  "name": "Ada",
  "born": 1815,
  "tags": [
    "math",
    "writer"
  ]
}

Common causes of invalid JSON

Doing the same thing in code

JavaScript

const pretty = JSON.stringify(JSON.parse(text), null, 2);
const compact = JSON.stringify(JSON.parse(text));

Python

import json
pretty = json.dumps(json.loads(text), indent=2)
compact = json.dumps(json.loads(text), separators=(",", ":"))

JSON Formatter & Validator FAQ

Is my JSON uploaded to a server?

No. Parsing and formatting happen with the browser’s own JSON engine, on your device. Nothing you paste is sent anywhere — useful when the JSON contains API keys, tokens or customer data.

How do I find exactly where a syntax error is?

When the input is invalid, the result panel shows the line and column of the problem, plus a short description such as a missing comma or an unquoted key. Trailing commas and single-quoted keys are the two most common causes.

What does “Sort keys alphabetically” do?

It reorders every object’s keys (recursively, at every nesting level) alphabetically without changing any values. Useful for diffing two JSON files where only the key order differs.

Can I format a single value, like just a number or a string?

Yes. 42, "hello" and true are all valid JSON documents on their own, and the formatter accepts them.