Skip to content
codevory

JSON Formatter & Validator

Format, validate and minify JSON. Errors point to the exact line and column, and nothing you paste leaves your browser.

JSON Formatter & Validator: the tool

Paste JSON to validate and format it.

Input

Formatted output

The result appears here.

How to use JSON Formatter

  1. Paste your JSON into the left panel, or press Example to load a sample.
  2. The right panel updates as you type. Choose Beautify for readable output or Minify for the smallest size.
  3. Pick the indentation (2 spaces, 4 spaces or tabs) and, if you want, sort the keys alphabetically.
  4. If the JSON is invalid, the status bar names the problem with its line and column. Press Go to error to jump to it.
  5. Copy the result, or download it as a .json file.

Example

A compact document on one line becomes easy to read once formatted. Pasting the input below into the tool produces the output shown.

Input
{"name":"codevory","version":"1.0.0","private":true,"tools":[{"slug":"json-formatter","stable":true},{"slug":"uuid-generator","stable":true}],"limits":{"maxMegabytes":10,"ratio":0.5},"owner":null}
Output, 2 spaces
{
  "name": "codevory",
  "version": "1.0.0",
  "private": true,
  "tools": [
    {
      "slug": "json-formatter",
      "stable": true
    },
    {
      "slug": "uuid-generator",
      "stable": true
    }
  ],
  "limits": {
    "maxMegabytes": 10,
    "ratio": 0.5
  },
  "owner": null
}

About this tool

JSON is a strict text format: property names and strings use double quotes, comments are not allowed and the last item of an object or array cannot be followed by a comma. This tool checks your input against that grammar (RFC 8259) before it prints anything, so a formatted result is also proof that the document is valid.

Formatting only changes whitespace. Numbers and strings are written back exactly as you typed them: a 20-digit identifier is not rounded the way JavaScript's JSON.parse would round it, and an escape such as \u00e9 stays as it is. The only change to the content is the order of keys, and only when you turn on Sort keys.

Everything runs in your browser tab. The text you paste is not sent to a server, which makes the tool suitable for API responses, configuration files and logs. Documents up to 10 MB are accepted.

Common JSON mistakes and how to fix them

MistakeInvalidValid
Trailing comma{"a": 1,}{"a": 1}
Single quotes{'a': 'b'}{"a": "b"}
Unquoted property name{a: 1}{"a": 1}
Comment{"a": 1} // note{"a": 1}
Leading zero{"id": 007}{"id": 7}
undefined, NaN or Infinity{"a": NaN}{"a": null}
Missing comma{"a": 1 "b": 2}{"a": 1, "b": 2}

Frequently asked questions

Is my JSON sent to a server?

No. Parsing and formatting happen in your browser, and the page makes no request with your data. You can confirm it in the Network tab of your browser's developer tools.

Why is my JSON invalid when the same object works in JavaScript?

A JavaScript object literal is more lenient than JSON. It allows trailing commas, single quotes, unquoted keys and comments, and JSON allows none of them. This tool applies the strict JSON rules, which are the ones every JSON parser, API and configuration loader enforces.

Does formatting change my data?

No. Only whitespace changes. Numbers and strings are kept exactly as written, including integers too large for a JavaScript number. Keys are reordered only if you enable Sort keys, and that does not change the meaning of the document.

What happens with duplicate keys?

The JSON grammar allows an object to repeat a key, but most parsers keep only the last value. The tool keeps every occurrence in the output and shows a warning with the position of each duplicate, so you can decide which one is right.

What is the difference between Beautify and Minify?

Beautify adds line breaks and indentation so people can read the document. Minify removes every optional space and line break to make it as small as possible for transfer or storage. Both produce the same data.

How large can the JSON be?

Up to 10 MB. Very large documents take a moment to process, and syntax colouring is switched off for outputs above 300 KB to keep the page responsive. The text is still formatted and can be copied or downloaded.