Skip to content

JSON formatter

Web & developer

How can you format and check JSON?

Paste JSON to find errors, tidy it up or make it compact.

Not saved in the link or anywhere else.

Output style

JSON validation

Valid JSON

Copy the full output or download it as a JSON file.

JSON output

{
  "b": 2,
  "a": [
    1,
    true,
    null
  ]
}

Source: up to 20,000 characters. Formatting: up to 32 nesting levels. JSON stays in this tab and never enters a link.

Duplicate keys keep the last value. Numbers use standard floating-point precision; out-of-range numbers and unsafe integers are not formatted.

Sponsored Links

Paste JSON to find errors, tidy it up or make it compact.

How to use

  1. Paste your JSON. The result immediately shows whether it is valid or where the first error occurs.
  2. Choose pretty print or minify. For pretty print, choose two spaces, four spaces or tabs. Optionally sort object keys.
  3. Copy the output or download a .json file. Long previews are shortened, but copies and downloads contain the full output.

Valid JSON values after minifying

InputMinified
[1, 2, 3][1,2,3]
[true, false][true,false]
[null, 0][null,0]
["a", "b"]["a","b"]
[[], []][[],[]]

Sponsored Links

How it works

JSON represents objects, arrays, strings, numbers, true, false and null. Object names and strings use double quotes. A trailing comma or a comment is not part of JSON. This checker follows the JSON grammar in RFC 8259 and reports the first error with a line and column, both counted from one.

Pretty printing adds line breaks and indentation; minifying removes unnecessary whitespace. For example, [1, 2] becomes [1,2] when minified. Spaces inside a string remain part of its value. Sorting rearranges object keys recursively while keeping array order; keys that are integer indices appear first in numeric order.

The tool accepts up to 20,000 source characters and formats up to 32 nesting levels. Duplicate names keep the last value. Decimal numbers may round to standard floating-point precision, while numbers outside the supported range and unsafe integers are refused for output. Text stays in the browser and is never put in a link.

Frequently asked questions

Why is my JSON invalid?

Common causes are single quotes, unquoted names, comments and trailing commas. The reported position is where the problem was detected; a missing quote or bracket may be earlier.

Does formatting preserve every character?

No. Whitespace, escapes and number notation may change. Duplicate keys keep only the last value, and decimal precision is limited. Use quoted strings for identifiers or exact decimal amounts that must not change.

Why does valid JSON sometimes produce no output?

Validation checks syntax separately from formatting limits. Deeply nested data, non-finite parsed numbers and integers outside the safe range can be syntactically valid but are not formatted.

Can a JSON document be just a number or a string?

Yes. A JSON value can be an object, array, string, number, true, false or null.

Does sorting keys also sort arrays?

No. Sorting changes object keys recursively; array elements keep their order.

Sponsored Links

Sponsored Links