JSON formatter and validator

Format and validate JSON in your browser: nothing is uploaded, so API responses with tokens or personal data stay on your device, and there is no limit on the size. An error shows the line and character where it goes wrong.

Indent

How it works

  1. Paste your code

    Paste the code in the left box or open a file. No code to hand? Click Example.

  2. Instant result

    The result appears as you type. If there is an error, you see the line and character.

  3. Copy or download

    Copy the result with one click or save it as a file for your editor or project.

Validating JSON

Common mistakes are a comma after the last item, single quotes instead of double quotes, keys without quotes, and comments (JSON doesn't allow them). The formatter points to the exact spot, for example line 4, character 12: extra comma before }.

Options

  • Indent with 2 or 4 spaces or a tab, or all on one line to minify.
  • Sort keys alphabetically makes two JSON documents easy to compare.

Very large numbers

JavaScript stores numbers with about 15 significant digits. IDs that are longer than that (as in some APIs) can be rounded. The tool warns you when your JSON contains such numbers. Converting JSON? Try JSON to CSV or JSON to YAML.

Why format JSON locally?

JSON from an API often contains things you should not paste into a random website: access tokens, e-mail addresses, customer records. This formatter runs entirely in your browser, so the document never reaches a server. Use it with real data without a second thought, and still be careful with credentials on shared screens.

Comparing two JSON documents

Two documents that mean the same can look different because the keys are in another order. Turn on Sort keys alphabetically on both and format them with the same indent, and a normal diff tool shows only the real differences. Sorting changes only the order of keys in objects, never the order of items in an array.

Minifying for transport

Choose All on one line to remove every unnecessary space. That is useful for a request body in a command-line test or for embedding JSON in a script. To embed it as a string inside other JSON, escape it afterwards with JSON escape.

What this tool does not accept

JSON is stricter than JavaScript object notation: no comments, no trailing commas, no single quotes and no unquoted keys. If a config file with comments is what you have, remove the comments first, or convert it from YAML with YAML to JSON.

Frequently asked questions

Why is my JSON invalid?

The usual causes are a trailing comma, single quotes, an unquoted key or a comment. The message shows the line and character of the first problem.

Does sorting keys change the data?

Only the order of keys in objects changes. Arrays keep their order, and the content is the same.

What happens to very large numbers?

JavaScript keeps about 15 significant digits. IDs with more digits can be rounded, and the tool warns you when your JSON contains such numbers.

Is my JSON uploaded?

No. It is formatted in your browser and never sent to a server.