JSON Formatter & Validator
Beautify, minify, sort and validate JSON in your browser. Errors point at the exact line.
JSON Formatter beautifies, minifies, sorts and validates JSON entirely in your browser. Paste a response from an API, a config file or a log line, and get readable indented output — or, when a document is malformed, the exact line and column where parsing failed. Nothing is uploaded, so it is safe to paste production payloads.
How JSON Formatter & Validator works
Formatting JSON is really two jobs: parsing and printing. The parser reads your text and either produces a JavaScript value or fails. If it fails, the failure is the useful output — a formatter that just says "invalid JSON" has wasted your time. This tool surfaces the parser's own diagnosis and, where the browser gives a character offset, converts it to a line and column so you can jump straight to the problem instead of counting characters.
Once parsed, printing is a choice about whitespace. Beautify re-emits the document with two or four spaces (or tabs) of indentation per level, which is what you want while reading or debugging. Minify emits it with none, which is what you want on the wire — for a large API payload the saving is routinely 20–30% before compression even starts. Sort keys re-emits the document with every object's keys in alphabetical order, recursively. That one is underrated: two JSON documents that are semantically identical but written in different key orders look completely different in a diff, and sorting both first makes the real differences visible.
Worth knowing about what JSON does not allow, since these are the errors people hit most: comments are not permitted, trailing commas after the last element are not permitted, keys must be wrapped in double quotes, and single quotes are never valid for either keys or strings. JavaScript object literals allow all of those, which is exactly why code pasted out of an editor so often fails to parse here.
Everything runs locally in your browser using its native JSON parser — the same one your code uses. There is no upload, no logging and no size limit beyond your device's memory, so pasting a production API response, an access token payload or a customer record carries no more risk than opening the file in a text editor.
How to use JSON Formatter & Validator
Paste your JSON
Drop in an API response, a config file or any JSON string. You can also open a .json file from your device.
Pick a mode
Beautify for readable indented output, Minify to strip every unnecessary byte, or Sort keys to make two documents comparable.
Copy or download
Copy the result to your clipboard in one click, or download it as a .json file.