JSON Formatter & Validator

Paste your JSON and format it, check it, or squeeze it onto one line — free, with no sign-up, and nothing ever leaves your browser.

100% FreeNo sign-up neededPrivate — in-browser only

Format your JSON

A small valid sample is already loaded, so the formatted result is waiting below. Replace it with your own JSON whenever you are ready.

🔒 Your JSON is processed entirely in your browser — nothing is uploaded or stored.

Formatted output

Checking your JSON…


The output above is produced by your browser’s own JSON parser, so a document this tool calls valid will parse the same way in any other strict JSON parser. Formatting uses a 2-space indent; minifying removes every space and line break the grammar allows.

Key Takeaways
  • JSON is plain text with only six kinds of value and a handful of strict rules — one bad character is enough for a parser to refuse the whole document.
  • Trailing commas, single quotes, unquoted keys, comments, and missing brackets cause most failures, and all five are legal in JavaScript but not in JSON.
  • Format when a person needs to read the file, minify when a machine needs to receive it — the data itself never changes either way.

What is JSON?

JSON, short for JavaScript Object Notation, is a plain-text way of writing structured data so that different programs can read it. A JSON document is just text: pairs of names and values inside curly braces, lists inside square brackets, and simple values such as words in double quotes, numbers, true, false, or null. Because it is only text, any program in any language can read it, which is why so much of the web runs on it. When a website loads your account details, a weather app fetches a forecast, or one service talks to another, the data travelling between them is very often JSON.

The format is deliberately small. There are only six kinds of value — objects, arrays, strings, numbers, true and false, and null — and a handful of punctuation marks that hold them together. That smallness is the point: a format with few rules is easy to write, easy to read, and hard to misunderstand. The trade-off is strictness. JSON forgives nothing — a single missing comma or a pair of single quotes is enough for a parser to refuse the whole document, which is why a validator earns its place.

How to use it, in 3 steps

1

Paste your JSON

Paste your JSON into the box above, or type it in directly. A small sample is already loaded, so the formatted result is waiting for you before you type a thing.

2

Format, validate, or minify

Press Format to tidy it with two-space indenting, Validate to check it, or Minify to squeeze it onto one line. Any error is reported with its line and column, so you know exactly where to look.

3

Copy or download

Press Copy output to take the result back to your clipboard, or Download .json to save it as a file. Press Clear to empty both boxes and start again with a fresh document.

The common mistakes that break JSON

Most broken JSON is broken in one of five ways, and all five come from writing JSON the way you would write JavaScript. JavaScript object literals are forgiving; JSON is not. The table below shows each mistake, the broken text, and the fix. Check your document against it before you blame the tool that rejected it.

MistakeBrokenFixedWhy it fails
Trailing comma{"a": 1,}{"a": 1}A comma must sit between two items, never after the last one.
Single quotes{'a': 1}{"a": 1}Strings and keys need double quotes.
Unquoted keys{a: 1}{"a": 1}Every key is a double-quoted string.
Comments{"a": 1} // note{"a": 1}JSON has no comment syntax at all.
Missing bracket{"a": [1, 2}{"a": [1, 2]}Every opening bracket needs its matching closer.

Two more traps catch people out. A missing comma between two members is easy to miss in a long object, and a capitalised True or Null is not JSON — only lowercase true, false, and null are allowed. Both are flagged by the validator above with the exact position of the problem.

When to format, and when to minify

Formatting and minifying do the same job in opposite directions: neither changes the data, only the way it looks. Formatting spreads a document over many lines with two-space indenting, so you can scan it, spot a wrong value, and find a missing bracket. Use it whenever a person needs to read the file — while debugging, while writing a config file by hand, or while checking what an API sent back.

Minifying does the reverse: it strips every space, line break, and indent, leaving the whole document on a single line. The data is identical, but the file is smaller and easier to send over a network or store. Use it when a machine is the reader — before sending data to an API, saving it to a database, or pasting it into a field with a size limit. Formatting adds line breaks and spaces, so a formatted object or array is always longer than its minified twin. By how much depends on the file — a percent calculation will tell you exactly.

A worked example

{
  "name": "Ada Lovelace",
  role: "programmer",
  "born": 1815,
}

Take the short document above, which refuses to parse. It has two faults at once: the key role has no quotes around it, and a comma follows the last member. Paste it into the box and press Validate. The tool reports the unquoted key first: “Expected double-quoted property name in JSON at position 30 (line 3 column 3)”. A parser stops at the first problem it meets, so fix that key, press Validate again, and the trailing comma is flagged next: “Expected double-quoted property name in JSON at position 68 (line 5 column 1)”. Remove it, press Format, and the document comes back tidy, valid, and ready to use — the same data, with nothing else changed.

JSON questions, answered

Is my JSON uploaded or stored anywhere?

No. Your JSON is processed entirely in your browser by the script on this page. Nothing is uploaded to a server, nothing is stored, and closing the page removes everything.

What does the “position” in an error message mean?

It is the character number where the parser gave up, counting from the start of your text. This tool converts that number into a line and column, so instead of hunting through the whole document you can go straight to the exact spot.

Why does my text fail here when it works in JavaScript?

Because a JavaScript object literal is not JSON. JavaScript allows single quotes, unquoted keys, trailing commas, and comments; JSON allows none of them. The grammar is defined by RFC 8259, and a strict parser rejects anything outside it, even if JavaScript would accept the same text.

When should I minify instead of format?

Minify when a machine is the reader — before sending data to an API, saving it to a database, or pasting it into a field with a size limit. Format when a person is the reader — while debugging, editing a config file, or checking what an API sent back. The data is identical either way.

Related calculators

Disclaimer: This tool formats, validates, and minifies JSON entirely in your browser using the browser’s own JSON parser. The rules it enforces are the JSON grammar defined by RFC 8259: double-quoted keys and strings, no trailing commas, no comments, and only lowercase true, false, and null. Error wording comes from your browser’s parser and can differ between browsers; the line and column shown always point at the same spot in your text.
↑