JSON Formatter & Validator
Understand JSON Formatter & Validator
This formatter re-prints JSON with consistent indentation, collapses it back to a single line, or tells you where it is broken.
How it works
The text is parsed into real values and then printed again, so the output is canonical rather than merely re-spaced: whitespace is regenerated, escape sequences are normalized, and 1e3 comes back as 1000. Anything that is not valid JSON fails at the parse step, and the error names the character position where the parser gave up. Minifying is the same round trip with the indentation set to nothing.
When to use it
- Making a one-line API response readable before you try to read it.
- Finding the character offset of a syntax error in a payload a service rejected.
- Minifying a config or fixture before embedding it in a string literal.
- Normalizing two payloads to the same indentation so a diff shows real differences instead of formatting noise.
Watch out for
- JSON is not JSONC or JSON5. Comments and trailing commas are syntax errors, which is why tsconfig.json and .eslintrc often fail here — they are JSON with comments, a different format.
- Integers beyond 2^53 − 1 lose precision on the round trip. A snowflake ID such as 9007199254740993 comes back as ...992, so the formatted output is quietly a different number. Keep large IDs as strings.
- Duplicate keys collapse silently. {"a":1,"a":2} parses without complaint and the last value wins, so genuinely ambiguous input formats as though it were fine.
- Validating checks syntax only. A response can be flawless JSON and still be missing every field your code needs.
Not the right tool for: Checking that data matches an expected shape — that is what the JSON Schema validator does.
Frequently Asked Questions
What is JSON?
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write and easy for machines to parse and generate.
What are common JSON errors?
Common errors include trailing commas (not allowed in JSON), single quotes instead of double quotes, unquoted keys, and undefined/NaN values.
What is the difference between formatting and minifying?
Formatting adds indentation and newlines for readability. Minifying removes all unnecessary whitespace to reduce file size — useful for production APIs.
How to Use JSON Formatter & Validator
- Paste or type your input in the input area above.
- The tool processes your input automatically or click Run.
- Copy or download the result using the action buttons.
- Use Ctrl+Enter to run quickly from the keyboard.