JSON formatter and validator
Beautify messy JSON, find the exact line where it breaks, minify it for production or sort keys for clean diffs.
Validation errors show the line and column. Runs entirely in your browser.
How to use it
- Paste JSON into the left box.
- Click Format for two- or four-space indentation, Minify to strip whitespace, or Sort keys to order every object alphabetically.
- If the JSON is invalid, the message shows the error with the line and column so you can jump straight to it.
The errors you will see most
- Trailing commas.
{"a": 1,}is valid JavaScript but invalid JSON. - Single quotes. JSON strings and keys need double quotes:
{"name": "api"}, not{'name': 'api'}. - Unquoted keys.
{name: "api"}works in JavaScript objects but not in JSON. - Comments. JSON has no comments. Remove
//and/* */lines, or use JSONC or YAML if you need them. - Special numbers.
NaN,Infinityand leading zeros such as007are not allowed.
Why sort keys?
Two JSON files with the same data but different key order produce noisy diffs. Sorting keys before you commit fixtures, snapshots or config makes code review show only the changes that matter.
Minified or formatted in production?
Serve minified JSON from APIs, since gzip or Brotli compression already removes most of the size difference but every byte still counts on mobile. Keep formatted JSON in your repository so people can read and review it.
FAQ
Is my JSON uploaded anywhere?
No. Parsing and formatting use your browser's built-in JSON engine. Nothing is sent to a server.
What is the difference between a JSON formatter and a validator?
A validator checks whether the text is valid JSON; a formatter rewrites valid JSON with consistent indentation. This tool does both: formatting only succeeds when the input validates.
Can it handle large files?
Files of several megabytes format in well under a second in a modern browser.
Does sorting keys change my data?
No. JSON objects are unordered by specification, so sorting changes only the presentation. Array order is always preserved.
Is it free?
Yes. Every tool at ryzlabs.com/tools is free with no sign-up.
Need senior backend engineers on your team?
Ryz Labs places senior backend and API engineers who work in your repos and standups and report to your leads, on US business hours.
Start a conversation →