Developer Tools
JSON Formatter & Validator
Pretty-print, minify and validate JSON with exact error positions.
JSON input
0 charsResult
no outputFormatted JSON appears here.
About JSON Formatter
JSON is easy for machines and miserable for humans. A minified API response or a single-line log payload becomes readable the moment it is indented properly, and a validator tells you why a payload is rejected instead of leaving you to squint at a sea of braces.
This formatter parses your input with the native JSON parser, so it accepts exactly what your runtime accepts and rejects exactly what your runtime rejects. When parsing fails you get the character position reported by the parser, mapped back to a line and column in your original text.
How it works
- Your input is parsed with JSON.parse, the same parser your browser and Node.js use.
- Choose an indent size of 2, 4 or a tab to control the output layout.
- Minify removes all insignificant whitespace for transport or embedding.
- Optional key sorting rewrites objects alphabetically, which makes diffing two payloads far easier.
- When the input is invalid, the reported offset is converted into a line and column pair so you can jump straight to it.
Input and output
Accepts
Raw JSON text, a snippet copied from a log, or a .json file.
Produces
Formatted or minified JSON, byte and line counts, and validation errors with line and column numbers.
Privacy
JSON parsing and formatting use the browser JSON parser only. Your payload is never transmitted.
JSON Formatter FAQ
What is the difference between a JSON formatter and a JSON validator?
A validator only answers whether the document is valid JSON and where it breaks. A formatter goes one step further and rewrites valid JSON with readable indentation.
Why does my JSON fail to parse when it looks fine?
The most common causes are trailing commas, single quotes instead of double quotes, unquoted object keys, comments, and NaN or Infinity. None of those are part of the JSON specification.
Does formatting change my data?
No. Formatting only changes whitespace between tokens. Values, key order (unless you enable sorting) and numeric precision are preserved.
Can I format very large JSON files?
Yes, up to the memory limits of your browser tab. Files beyond roughly 50 MB may be slow because the whole document is held in memory as a string.