JSON formatter and validator

Validate, pretty print, minify and sort JSON with clear errors.

What this JSON tool does

Paste JSON into the box and the tool tells you at once whether it is valid. If it is, you get a clean, indented version you can copy or download, or a minified one with all whitespace removed. If it is not, you get a plain-language explanation, the line and column of the problem, and a button that jumps the cursor straight to it.

It runs entirely in your browser. API responses, configuration files and tokens you paste are never uploaded, which matters when the data is private.

How to use it

  1. Paste your JSON into the input box, or press "Try an example".
  2. Read the status line under the box. A green "Valid JSON" shows the type, the number of values, the nesting depth and the size before and after formatting.
  3. Choose the indentation: 2 spaces, 4 spaces, tabs, or minified.
  4. Tick "Sort keys A to Z" if you want a stable order, which makes two JSON files easy to compare.
  5. Copy the result, or download it as a .json file.

The most common JSON mistakes

JSON looks like a JavaScript object but is stricter. These are the errors people hit most often, and the tool names each one:

  • A trailing comma after the last item, such as [1, 2, 3,].
  • Single quotes instead of double quotes around strings.
  • Unquoted property names, such as {name: "x"} instead of {"name": "x"}.
  • Comments. Standard JSON has none, so // note and /* note */ are errors.
  • Numbers with a leading zero or plus sign, such as 01 or +5, or ending in a dot such as 1..
  • Raw line breaks inside a string. Inside a string, a new line must be written as an escape sequence.
  • Missing brackets or quotes, which show up as "ends too early".
  • Values JSON does not have, such as undefined, NaN and Infinity.

Your numbers stay exactly as written

Many online formatters parse the data into JavaScript values and print it again. That silently changes some numbers: an ID like 12345678901234567890 becomes 12345678901234567000, and 1.50 becomes 1.5. This tool reads and prints the original text of every number, so formatting never alters your data. Key order is preserved too, unless you choose to sort.

Duplicate keys

An object with the same key twice, such as {"a": 1, "a": 2}, is technically valid, but most programs keep only the last value. The tool still formats it and warns you about the repeated key so you can decide what you meant.

Tips

  • Use minified JSON when you send data over a network, and pretty printed JSON when a human has to read it.
  • Sort keys before committing a JSON file to version control, so the diff only shows real changes.
  • If the error position looks wrong, look just before it: a missing comma or quote is usually reported at the next token.

Frequently asked questions

Is my JSON uploaded to a server?

No. Parsing and formatting happen in your browser. Nothing is sent anywhere, so it is safe to paste private API responses and config files, though you should still avoid pasting live secrets onto any page you do not control.

What is the difference between formatting and validating?

Validating checks that the text follows the JSON rules. Formatting (pretty printing) then rewrites valid JSON with indentation so it is easy to read. This tool does both in one step.

Will it change my numbers or the order of my keys?

No. Numbers are kept exactly as typed, including very large ones and trailing zeros, and keys stay in their original order unless you ask to sort them.

Why is a trailing comma an error?

The JSON standard does not allow a comma after the last item in an object or array. Some languages and tools tolerate it, which is why it is such a common slip. Remove the comma.

Can it handle large files?

It accepts input up to about 5 MB. Very large documents may take a moment to display because the browser has to draw all the text.

Does it support JSON with comments or single quotes?

No. It validates standard JSON as defined by RFC 8259, and tells you exactly which non-standard feature it found so you can fix it.