JSON Formatter and Validator

Checks JSON for mistakes and lays it out with neat indentation, or squeezes it down to a single compact line. It is useful when reading a messy API response or config file, or when you need to find the exact line and column of a syntax error.

Up to 1 MiB.

Options

How to use the JSON Formatter and Validator

  1. Paste JSON and choose Format, Minify or Validate only.
  2. Select Format JSON. Errors show the line and column of the problem.

Rules applied

  • Strict JSON (RFC 8259): comments, trailing commas, single quotes and unquoted keys are errors.
  • Numbers are copied exactly as written, so large or precise numbers are never rounded.
  • Duplicate keys are kept and reported, because programs handle them differently.

Limitations

  • Maximum input is 1 MiB and nesting is limited to 1,000 levels. Sorting keys uses simple code-point order.

Worked examples

Format with 2 spaces

Input

{"name":"KotakText","tools":100,"tags":["text","free"],"id":12345678901234567890}

Result

{
  "name": "KotakText",
  "tools": 100,
  "tags": [
    "text",
    "free"
  ],
  "id": 12345678901234567890
}
Minify

Input

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

Result

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

Practical uses

  • Reading a minified API response

    A developer receives a one-line response from an API and cannot follow the nesting. They paste it and choose Format, which lays it out with indentation. The nested fields are now easy to follow while debugging.

  • Finding a typo in a config file

    A site owner edits a JSON settings file and the app refuses to load it. They paste the text and validate it, and the tool reports the line and column of the problem. In this case it is a trailing comma, which is easy to fix once it is located.

  • Minifying data for a request

    A tester wants a compact payload for a test request. They paste a neatly formatted sample and choose Minify, which removes the extra whitespace. Numbers are copied exactly as written, so the data itself does not change.

Privacy: this tool runs entirely in your browser. Your text is not uploaded, logged or saved, and it is never sent to analytics. Maximum input: 1 MiB.