JSON Formatter & Validator
Indent, validate and sort JSON, with errors that say where.
Makes two versions of the same object comparable line by line.
Everything is processed in this tab. Nothing you paste is sent anywhere.
Every tool runs entirely in your browser. Your files are never uploaded to a server.
A JSON formatter re-indents JSON so its structure is readable, and reports exactly where the syntax breaks if it does not parse. This one runs in your browser, so config files and API responses never leave your machine.
How to use JSON Formatter
- Paste your JSON. Anything from a one-line API response to a large config file.
- Pick an indent. Two spaces, four, tabs, or minify to strip whitespace entirely.
- Copy the result. Formatting happens as you type. Sort keys if you are comparing two versions.
About formatting JSON
JSON is deliberately a very small language, and almost every "invalid JSON" complaint comes from expecting it to be JavaScript. It is not. Trailing commas are illegal, comments of any kind are illegal, keys must be double-quoted strings, and single quotes are never valid anywhere. NaN and Infinity cannot be represented at all, which is why a serialiser handed one usually emits null and silently changes your data. Numbers are double-precision floats, so an identifier longer than about fifteen digits will not survive a round trip intact — the reason APIs return large IDs as strings. The other common surprise is key order. The specification says objects are unordered, and while every mainstream parser preserves insertion order in practice, nothing guarantees two systems will emit the same order for the same data. That is why comparing two JSON documents by eye so often shows differences that are not differences, and why sorting keys before diffing turns an unreadable comparison into a short one. Formatting itself changes nothing about the value: indentation is whitespace between tokens, and whitespace is insignificant in JSON. Minifying and re-expanding a document produces exactly what you started with.
Frequently asked questions
Why does my JSON say invalid when it looks fine?
Is it safe to paste an API response with credentials in it?
What does sorting keys do?
Does minifying change the data?
Last updated