Developer tools

JSON formatter & validator

Tidy or compress JSON and see exactly where it is broken.

This tool runs entirely inside your browser. No file or text is sent to any server.

How to use

  1. Type or paste your JSON into the upper box. To just try the tool, press “Insert an example”.
  2. Look at the state of the JSON above the upper box. If it has mistakes, a yellow badge says how many were found, and under the box you see what each one is and on which line and column. “Go to the error” puts your cursor right there; if there is more than one, each press moves on to the next, and after the last it starts again from the first.
  3. Fix the mistakes in the same box. When all of them are fixed, a green “No errors” badge appears.
  4. Choose the shape of the result: “Tidy” or “Compact”. In the tidy shape you can change the indentation too, and in both shapes you can sort the keys alphabetically.
  5. Once you have seen the green “No errors” badge above the upper box, press the green button “Move the JSON to the result box”. The result lands in the “Result” box below, and the upper box stays untouched.
  6. Press “Copy”, under the “Result” box, and take the result.

Notes on this tool

The strictness is on purpose: no mistake is quietly corrected, because a tool that guesses what you meant could change your data without telling you. Every mistake is reported by name and place, and fixing it is up to you.

If there is more than one mistake, the tool lists up to a hundred of them. Only the first is certain; the others are found on the assumption that the ones before them have been fixed in the simplest way, say a missing comma put in or single quotes made double. Where fixing would take a guess, for example a square bracket closed with a curly one, the search stops there; the same happens when there are more than a hundred. In both cases the yellow badge puts “At least” in front of the number, for example “At least 5 errors found”; that means there are 5 or more, and more mistakes may turn up once these are fixed. The list is rebuilt with every change of the text.

The “Result” box is a copy of the upper box as it was when you pressed the move button. If you change the upper box after that, the result does not change by itself; a note under it says it is out of date, and you press the move button again to bring it up to date. But as long as the upper text is still the same, changing the shape, the indentation or the key order updates the result at once.

Values never change; only the spaces do and, if you ask for it, the order of the keys. Numbers and strings stay exactly as you wrote them: a twenty-digit id is not rounded, 1.10 does not become 1.1, and Persian text is not turned into escape codes.

Persian digits are fine inside strings (between the quotes), but a number itself must use Latin digits: 12 is correct and “۱۲” is an error. So when a Persian digit or comma turns up outside quotes, a button appears that turns just those into Latin ones and leaves the text inside quotes alone.

Sorting the keys follows the computer’s internal character order, not any language’s alphabet: digits come first, then capital letters, then small ones (so Z comes before a), and Persian letters come after all the English ones. The order of items inside an array is never changed, because there the order means something.

A key written twice in one object is not an error in standard JSON, so it is not one here either, and both are kept. You only get a warning, because most programs read just the last value and the first one silently disappears.

Frequently asked questions

What is JSON and what is it for?
JSON is a plain text format for storing and moving data: lists (arrays) and collections of “name: value” pairs (objects). Most websites and programs use it to talk to each other, to save settings and to fetch information from a server. Even if you do not program, you will probably meet it in a service’s answer or a settings file that has to be read or fixed.
Why does JSON I copied from JavaScript or Python code give an error?
Because the two look alike but JSON’s rules are stricter. The usual culprits: single quotes instead of double, a key without quotes, a comma after the last item, a comment, and True, None or undefined instead of true and null.
What is the difference between “Tidy” and “Compact”, and which should I use?
For the data there is no difference; only the spaces differ. The tidy shape is for reading, editing and comparing two versions. The compact shape is smaller and suits sending in a request, storing in a database or pasting on one line.
Why does the result not appear by itself, and why must I press the move button?
Because that way the upper box always stays exactly what you wrote: the tool never changes anything in it, and Ctrl+Z always works. And you take the result when you are ready for it.
Why does the error message sometimes point at a place where nothing is wrong?
Because the tool reads from the start and reports each mistake at the place where it cannot go on. The real mistake is sometimes a little earlier: a forgotten comma shows up at the start of the next item, an unclosed bracket at the end of the text, and an unclosed quote a few lines further on. So if the line shown looks fine, look at the lines before it.
How big can the JSON be?
The tool sets no limit, and a file of several megabytes opens fine; on a weak device it may take a few seconds. The only limit is nesting deeper than a thousand levels, which gives an error.

Related tools

Strong password generator

Create a secure random password with the length and character mix you choose.

Passwords & security

QR code generator

Turn a link, phone number or any text into a QR code — in your browser, no internet needed.

Codes & data