Skip to main content
UploadFree

JSON Formatter & Validator

Check JSON for errors, then format or minify it. Numbers and keys stay exactly as you wrote them, and your JSON stays on your device.

Read only

Your JSON stays in this tab only. It is not saved, so refreshing or closing the page clears it.

Indentation (for Format)

Nothing is processed while you type. Press a button, or Ctrl+Enter (Cmd+Enter on Mac) to format.

Add JSON, then choose Format, Minify or Validate. The result appears here.

How to format and validate JSON

  1. Add JSON

    Type or paste JSON, import a local .json or .txt file, or load the example.

  2. Choose an action

    Format, Minify or Validate. Pick 2 spaces, 4 spaces or tabs for Format.

  3. Check and use the result

    Read the status, then copy the output, download it as .json or use it as the new input.

What this tool does with your JSON

  • Strict JSON only. The input must be standard JSON. Comments, trailing commas, single quotes, unquoted keys, NaN and Infinity are errors, not something to be fixed quietly. Nothing is repaired: if the input is invalid you get an error and no output. Any value can be the top level, not only an object or array, so "text", 42, true and null are valid.
  • Errors with a place. An error says what is wrong in plain words, with the line and column the parser reached and a short excerpt. Go to error moves your cursor there. Some mistakes, such as a missing closing bracket, can only be found at the end of the input, so the place shown is where the parser noticed, which can be after the mistake itself.
  • Numbers and strings are not changed. Numbers are copied exactly as you wrote them, so 12345678901234567890 and 1e30 do not lose precision or change their form, and 1.50 stays 1.50. Strings are copied as written, escapes and spaces inside them included. Format and Minify change only the whitespace between values.
  • Duplicate keys are warned about. If an object has the same key twice, both entries are kept in their original order and the status lists the repeated keys with a line and column. Most programs keep only the last value, so a repeat is usually a mistake. Keys written differently, such as "a" and "a", count as the same key.

Actions, output and sizes

  • Format, Minify and Validate. Format adds line breaks and your chosen indentation; empty objects and arrays stay as {} and []. Minify removes all whitespace outside strings. Validate only checks the input and makes no output. Nothing runs while you type; it runs when you press a button.
  • Sizes. Input and output sizes are counted in UTF-8 bytes. When Minify makes the text smaller, that is whitespace removed from the text, called a size reduction here. It is not the same as network compression such as gzip.
  • Out of date output. If you change the input afterwards, or the indentation after a Format, the output and status are marked out of date. A Format or Minify that fails clears the output, so an old result never looks like the current one.
  • Use Output as Input and Undo. Replaces the input with the output so you can work on it further. Undo brings the previous input back, also after Clear, Import or Load Example.

Limits

maximum input size
5 MB
maximum nesting depth
128

Larger or deeper input is refused with a message rather than cut. A formatted result of more than 16,000,000 characters is refused too; Minify still works. Checking and formatting run in a background thread (a Web Worker) so the page stays responsive. Imported files must be UTF-8 text with a .json or .txt name.

What happens to your JSON

Everything runs in your browser. Your JSON is not uploaded and is not sent to any server, and it is only read as text: it is never run as code. It is not saved in the browser and not put in the page address. Refreshing or closing the tab discards it. See Privacy.

Not included

  • JSON5, comments or trailing commas
  • Schema validation
  • Automatic repair of invalid JSON
  • Sorting keys or editing as a tree
  • Converting to or from YAML or XML

Frequently asked questions

Is my JSON uploaded?

No. It is checked and formatted in your browser. The site only delivers the page and its code.

Why is my JSON with comments or a trailing comma invalid?

Those are common extensions, but standard JSON does not allow them, and many programs reject them. This tool follows the standard and shows where the first problem is instead of changing your text.

Will large numbers lose digits?

No. Numbers are never converted to JavaScript numbers, so long integers, exponents and trailing zeros are kept as written. Programs that read the JSON afterwards may still round them.

Why does it only show the first error?

After one syntax error, later messages are often side effects of it. Fix the first one and check again.

Do I need an account?

No. The tool is free and needs no sign-in.