JSON Formatter and Validator
Free online JSON formatter and validator. Beautify or minify JSON, get precise error messages with the exact line and column, sort keys and validate against a schema.
Free, no sign-upRuns in your browserNothing uploaded
Valid JSON
Parsed successfully.
Output, read only.
- input
- 215 B
- output
- 297 B
- change
- +82 B
- objects
- 3
- arrays
- 1
- keys depth
- 3
- strings
- 7
- numbers
- 3
Paste JSON in, get readable JSON out. The formatter pretty-prints with two, four or tab indentation, minifies back to a single line, sorts object keys alphabetically and strips whitespace inside strings if you need that. It is the fastest way to read an API response that arrived as one enormous line.
The validator is the part worth having. When JSON is invalid, almost every tool just says SyntaxError. This one tells you the line and column, shows the offending line with a caret under the exact character, and classifies the problem - a trailing comma, an unquoted key, a single quote instead of a double quote, a missing colon, a bare value. Those five account for nearly all real-world JSON errors, and naming the cause saves the guessing.
Everything is parsed in your browser with the native JSON parser, so a large payload cannot be used to attack anything and never leaves your device. You can also paste a URL to fetch and format a remote API response, validate against a JSON Schema, and switch between a syntax-highlighted view and plain text.
JSON Formatter & Validator features
How to use the JSON Formatter & Validator
Paste your JSON
Type or paste into the editor. Examples and any JSON Schema you have used are remembered in this browser only, so you can come back to the same work.
Choose an action
Format to prettify, Minify to compress, Sort keys to alphabetise object keys, or Compact strings to remove whitespace inside string values.
Read the result
The output is syntax highlighted and updates as you type. Character count, line count, object and array counts and the estimated byte size are shown under both panes.
Fix any error
If the input is invalid you get the line and column, a caret pointing at the character, and a plain-language description of what went wrong.
Copy or download
Copy the formatted output, or download it as a .json file. Minified output is typically 40 to 70% smaller than the formatted version.
Frequently asked questions
Why does my JSON say 'Unexpected token' even though it looks right?
Does JSON allow comments?
How much smaller does minifying make a file?
Can I format a JSON file directly?
Is my JSON sent anywhere?
What is the difference between JSON.parse and JSON5?
Related tools
Every tool, in one place
ToolForge has json formatter & validator plus a growing set of image, colour and developer tools. All of them run locally in your browser, free and without an account.
Browse all tools