# JSON formatter and validator

Paste JSON to format and validate it as you type. Errors show their line and column, long numbers stay exact, and comments, trailing commas and single quotes can be fixed. Minify or sort keys. Nothing is uploaded.

Page: https://toolkitnow.org/tools/json-formatter/

Paste JSON to format and check it. The gray text is an example.

## Good to know

### Exact values

Numbers and text are printed exactly as written. `12345678901234567890` stays as it is (JavaScript's `JSON.parse` rounds it to `12345678901234567000`), `1.10` keeps its zero and `\u00e9` stays escaped.

### Errors

The first problem is named with its line and column, for example a missing comma, a key without double quotes or a bracket that is never closed. Click the line number to jump to it.

### Fixing mistakes

With “Fix common mistakes” on, comments, trailing commas, single quotes and unquoted keys (habits from JavaScript and JSON5) are fixed in the output, and the line under the boxes says what changed. Missing commas and values such as `undefined` are not guessed.

### Duplicate keys

JSON allows the same key twice, but most programs keep only the last value. Both are kept here, and the first duplicate is pointed out.

### Minify and sort

Choose Minified to remove every space and line break outside strings. Sort keys orders the keys at every level by character code, so capital letters come before lowercase ones.

### JSON Lines

A file with one JSON value per line is not a single JSON document. To turn it into rows, use [JSON to CSV](https://toolkitnow.org/tools/json-to-csv/).

### Open from a link

`?input={"a":1}` opens the page with that JSON; add `&indent=4`, `tab` or `min`, and `&sort=1`. Write a + in the JSON as `%2B`, or it arrives as a space.

Runs in the browser; nothing is uploaded. Part of toolkitnow.org.
