Search tools

JSON Formatter and Validator

Pretty print, minify and validate JSON, with the exact line of any error and how to fix it.

Runs entirely in your browser. Nothing you paste is sent to our server, stored or logged.

Paste JSON above, or load the example.

Paste JSON to check it and tidy it up. Valid JSON comes back indented the way you like, or minified onto one line, with keys sorted if you want them. Invalid JSON gets the exact line and column of the problem and a plain explanation of how to fix it, from a trailing comma to a Python True that should be true.

What a JSON formatter does

JSON from an API or a log file usually arrives on a single line, which is fine for a computer and hard for a person. Formatting, also called pretty printing or beautifying, adds line breaks and indentation so the structure is easy to follow. Minifying does the reverse and strips every space a parser does not need. Neither changes the data: the same values come out, in the same order unless you ask for the keys to be sorted.

The mistakes that break JSON

JSON is stricter than the JavaScript it came from. Property names and strings need double quotes, so {'name': 'Ada'} and {name: "Ada"} both fail. A comma after the last item, as in [1, 2,], is an error, and so are comments. The keywords are lowercase true, false and null, which catches out anyone pasting Python's True or None. Numbers cannot start with a zero or a plus sign, and NaN and Infinity do not exist in JSON at all.

Big numbers stay exact here

Most online formatters run your JSON through JavaScript's own parser, which stores every number as a double. Whole numbers above 9,007,199,254,740,991 cannot be stored exactly that way, so an ID such as 12345678901234567890 quietly comes back as 12345678901234567000. This formatter keeps every number and string exactly as it was written, and tells you when your JSON holds numbers that other tools would round. It also keeps both copies of a key that appears twice, where most parsers silently drop the first.

How to use the json formatter

  1. Paste your JSONPaste it into the box, or load the example. It is checked as you type.
  2. Pick a formatChoose formatted or minified, two spaces, four spaces or tabs, and whether to sort the keys.
  3. Copy or downloadCopy the result, download it as a .json file, or fix the error it points to.

Common questions

Is my JSON sent to a server?

No. The formatting and checking happen in your browser, and nothing you paste is uploaded, stored or logged. There is no share link either, because JSON often holds tokens and personal data that should not end up in an address bar or a browser history.

What is the difference between formatting and validating JSON?

Validating checks that the text follows the JSON rules, so a program can read it. Formatting rewrites valid JSON with a layout that is easier to read or smaller to send. This tool validates first and formats only JSON that passes.

Why is a trailing comma an error?

The JSON standard, RFC 8259, does not allow a comma after the last item in an object or array. JavaScript and many config formats accept one, which is why it slips in so often, but a strict JSON parser rejects the whole document.

Can JSON have comments?

No. Standard JSON has no comments. Formats such as JSONC, used by VS Code settings, and JSON5 allow them, but the comments have to be removed before a normal JSON parser can read the file.

Does sorting the keys change my data?

No. The order of properties in a JSON object carries no meaning, so sorting them gives the same data in an order that is easier to scan and to compare. Arrays keep their order, because in an array the order does matter.

How large a file can it handle?

Several megabytes format in about a second on a typical laptop. The limit is your browser's memory rather than the tool, and very large results are shown without color so the page stays responsive.