DataHub Tools JSON Formatter

JSON Formatter

Local-first

Format, minify, and inspect JSON locally in your browser with a clean online JSON formatter.

How this tool actually works

This formatter calls the browser's JSON.parse, then serializes the parsed value with either two-space indentation or no extra whitespace. It validates strict JSON syntax but does not preserve duplicate keys, original number spelling, comments, or formatting.

  • Validate strict JSON syntax
  • Format with two-space indentation
  • Compact valid JSON

How to use it

  1. Paste strict JSON without comments or trailing commas.
  2. Choose format or compact.
  3. Review numbers, duplicate keys, and escaped characters against the source.
  4. Copy the result only after confirming semantic values were preserved.

Quick example

Example input

{"name":"Ada","active":true,"roles":["admin","editor"]}

Expected result

{
  "name": "Ada",
  "active": true,
  "roles": [
    "admin",
    "editor"
  ]
}

Duplicate keys keep only the last parsed value. Integers beyond JavaScript's safe range may be rounded silently.

Best use cases

  • Format API payloads for review.
  • Compact strict JSON for transport tests.
  • Check basic JSON syntax in the browser.

References and scope

RFC 8259 defines JSON syntax. ECMAScript defines the JSON.parse and JSON.stringify behavior used by this page, including JavaScript number limitations.

Sources checked July 24, 2026. Specifications and platform behavior can change; verify the sources before formal use.

Known limitations

  • JSON5, comments, trailing commas, and unquoted keys are rejected.
  • Parser error position and wording vary by browser.
  • An error can leave an earlier successful result visible, so do not copy stale output.

FAQ

Does it support JSON5 or comments?

No. Input must be strict JSON.

What happens to duplicate keys?

JSON.parse keeps the last value for a repeated object key.

Can it preserve very large integers?

Not reliably. Values beyond Number.MAX_SAFE_INTEGER may be rounded.

Does formatting validate a schema?

No. It validates syntax only, not required fields, types, or business rules.