How to use the JSON Formatter & Validator
- Paste JSON into the input box (or click Sample).
- Choose an indent size.
- Click Format, Minify or Sort keys.
- If the JSON is invalid, read the error line/column and fix it.
- Copy the result or download it as a .json file.
About this tool
JSON (JavaScript Object Notation) is the default data format of the modern web: REST APIs return it, configuration files are written in it, and logs are increasingly structured as it. Because machines usually emit JSON on a single line, it is almost unreadable to humans. A formatter re-indents the data so you can see the hierarchy of objects and arrays at a glance.
This tool parses your input with the browser's native JSON.parse, which follows the ECMA-404 / RFC 8259 grammar strictly. That means it will flag the mistakes that most often break production systems: trailing commas, single-quoted strings, unquoted keys, comments and stray control characters. When parsing fails we translate the engine's character offset into a line and column so you can jump straight to the problem.
Format vs. minify vs. sort
- Format adds indentation (2 spaces, 4 spaces or tabs) for reading and code review.
- Minify strips all optional whitespace — useful before embedding JSON in a URL, a header or a fixture where size matters.
- Sort keys orders object keys alphabetically at every level, which makes two JSON documents far easier to diff.
Frequently asked questions
Why does my JSON say 'Unexpected token'?
Usually a trailing comma after the last item, a single-quoted string, or a comment. Strict JSON allows none of these.
Is there a size limit?
No server limit — the practical limit is your device's memory. Multi-megabyte files format in well under a second on a modern laptop.
Does formatting change my data?
No. Formatting only changes whitespace. Sorting keys changes key order, which JSON treats as insignificant.
Can it validate JSON Schema?
This tool validates syntax only. Schema validation checks structure against rules and is on our roadmap.