JSON Formatter & Validator
Paste JSON to check that it is valid, make it easy to read, or squeeze it down to a single line, all without leaving your browser.
- Free
- No sign-up
- Runs in your browser
Your JSON is checked in this browser tab and is never sent anywhere.
How to use JSON Formatter
Paste your JSON
Put the JSON text into the input box. It can be an API response, a config file or a snippet from your code.
Choose how to output it
Select an indent of 2 spaces, 4 spaces or tabs, and optionally tick sort keys to put object keys in A to Z order. Then press Format, or press Minify for a compact single line.
Fix errors or copy the result
If the JSON is invalid, the tool shows the parser's error message so you can find the mistake. If it is valid, copy the output and use it where you need it.
Example
Formatting a one-line object
Input
{"name":"Ayesha","skills":["css","js"],"active":true}
Result
- {
- "name": "Ayesha",
- "skills": ["css", "js"]
- and so on, one key per line
Common uses
Reading API responses
A minified response from a server is hard to read. Formatting it with indentation makes the structure clear at a glance.
Validating configuration
Check a settings file for a missing comma or an extra bracket before an application fails to start.
Comparing and diffing
Sorting keys alphabetically makes two JSON files easier to compare, because the same data always comes out in the same order.
Shrinking payloads
Minify JSON that you embed in a page or send in a request, to remove whitespace and reduce its size.
Tips for better results
- JSON is stricter than JavaScript. Keys must use double quotes, trailing commas are not allowed and comments are not part of the format.
- Single quotes around strings are a very common mistake when JSON is copied from code. Replace them with double quotes.
- Sorting keys changes the order inside objects, but never the order of items inside an array, because the order of array items carries meaning.
- Numbers with more than about 15 digits, such as long IDs, can be rounded by any browser. The tool warns you when that happens, so store such values as text in quotes.
Frequently asked questions
Is my JSON sent to a server?
No. The text is parsed and formatted by your own browser, so private data such as tokens or customer records never leaves your device.
What does the error message mean?
It comes straight from your browser's JSON parser and usually names the unexpected character or the position where parsing stopped. Look at the text just before that spot.
What is the difference between Format and Minify?
Format adds line breaks and indentation so people can read the data. Minify removes every unnecessary space so the data takes the least room.
Is there a size limit?
You can paste up to 2 million characters. Larger files may be slow in the browser, so use a desktop editor for those.
Does it fix invalid JSON automatically?
No. It only reports the problem, because guessing how to repair data could silently change its meaning.
Last updated:
Guides and tutorials
DevelopersBase64 Encoding Explained in Plain EnglishWhat Base64 is, why it exists, how it turns bytes into text, why it is not encryption, and how to encode or decode a string safely, including URL-safe Base64. · 5 min read
- DevelopersCommon JSON Errors and How to Fix ThemThe JSON mistakes behind most parse errors, such as trailing commas and single quotes, with fixes, plus tips for reading error messages and validating data. · 5 min read