JSON Formatter and Validator
Format, validate, minify and sort JSON in your browser, with the exact line and column of any error.
API responses and config files are often a single unreadable line of JSON, and one missing comma can break everything. Paste it here to make it readable, find the exact spot of any error, or shrink it back down.
How to use the JSON Formatter and Validator
-
Paste your JSON
Paste JSON from an API response, a config file or a log into the box.
-
Format, minify or validate
Choose the indent and press Format, or press Minify for the smallest version, or Validate just to check it.
-
Fix and copy
If there is an error, the cursor jumps to it. Fix it, then copy or download the result.
Features
-
Exact error location
Shows the line and column of the problem and selects it in the editor.
-
Helpful hints
Spots common mistakes such as single quotes and trailing commas.
-
Indent options
2 spaces, 4 spaces or tabs, to match your project style.
-
Sort keys
Order object keys alphabetically, which makes comparing two files much easier.
-
Undo and redo
Switch between formatted and original versions with Ctrl+Z.
-
Private by design
JSON is processed in your browser, which matters for API keys and customer data.
When to use it
Debugging APIs
Make responses readable so you can find the field you need.
Fixing config files
Find the comma or bracket that stops package.json or a settings file from loading.
Preparing payloads
Minify JSON before sending it in a request or storing it.
Comparing data
Sort keys in two files so differences are easy to spot.
The most common JSON errors
Strings and keys must use double quotes, not single quotes. There can be no comma after the last item in an object or array. Comments are not allowed. Values such as undefined and NaN are not valid JSON; use null instead.
Why your data stays private
Many online formatters send what you paste to their servers. This one uses your browser’s built in JSON engine, so tokens, emails and customer records never leave your computer.
JSON versus JavaScript objects
JSON looks like JavaScript but is stricter. Keys must be in double quotes, strings cannot use single quotes or backticks, and functions, comments, undefined and trailing commas are not allowed. Code that works as a JavaScript object can therefore fail as JSON.
If you copied data from browser developer tools or source code, those differences are the usual cause of errors. Fix the reported line, press Validate again, and repeat until the status turns green. Sorting keys afterwards is a good way to compare two versions of the same configuration side by side.
Frequently asked questions
How do I format JSON?
Paste the JSON, choose an indent and press Format. Invalid JSON shows an error with its line and column.
How do I find an error in my JSON?
Press Validate. The tool tells you the line and column and highlights the position in the editor.
What is the difference between format and minify?
Format adds line breaks and indentation for people to read. Minify removes all extra spaces to make the file as small as possible.
Is it safe to paste API keys here?
Yes. The JSON is processed in your browser and is never sent anywhere.
Can it fix my JSON automatically?
It points out the exact problem and gives hints, but you choose the fix, so your data is never changed in ways you did not expect.
Does sort keys change my data?
Only the order of keys inside objects. Values and array order stay the same.