Bug Days

JSON Formatter & Validator

Beautify, minify, or explore JSON. Exact numbers and duplicate keys stay intact. Everything runs in your browser.

Drop a JSON file here or choose Open file. Nothing is uploaded.

Paste JSON, open a file, or try the sample.

Need to check an API contract? JSON Schema Doctor validates required fields, types, enums, and nested rules. Try a four-error example →

Format, validate, and explore JSON in your browser

A minified API response hides the relationship between fields. This free online JSON formatter adds two-space, four-space, or tab indentation so you can inspect objects and arrays. Use it as a JSON beautifier, pretty printer, syntax validator, or collapsible JSON viewer. Start with Load sample, paste a response, or open a local file.

Prettify formats valid JSON. Compact minifies it to one line. Validate checks syntax without changing your input. Undo restores the previous text. Copy or download the JSON, then use Share JSON to give someone a reproducible example. Formatting runs in a local worker with a Cancel action.

JSON pretty-print example: inspect an API response

Minified API response

{"orders":[{"id":"ORD-42","status":"paid","total":29.5,"items":["notebook","pen"]}],"pagination":{"page":1,"hasNext":false}}

Formatted JSON

{
  "orders": [
    {
      "id": "ORD-42",
      "status": "paid",
      "total": 29.5,
      "items": [
        "notebook",
        "pen"
      ]
    }
  ],
  "pagination": {
    "page": 1,
    "hasNext": false
  }
}

Synthetic data. These links contain the example and settings; no stored share is needed.

The order is easier to follow after formatting: orders is an array, its first item contains status and items, and pagination.hasNext is a boolean. Formatting does not turn false into a string or remove spaces inside a string value.

Find a nested value with the JSON tree

Open Tree & Fold, expand an object or array, and select a value. The selected-value panel copies a jq accessor such as .orders[0].status, a JSON Pointer such as /orders/0/status, or the exact value. Array indexes start at zero. .["content.type"] identifies one key, whereas .content.type follows two nested keys.

Branches load 50 items at a time, up to 1,500 displayed values. For remaining data, use Find in text. The tree copies paths; it does not run jq queries. See the JSON formatting and jq path guide.

Fix common invalid JSON errors

  • Use double quotes for keys and strings: {"name":"Ada"}.
  • Remove trailing commas before } or ].
  • Use lowercase true, false, and null.
  • Escape quotes and line breaks inside strings.
  • Remove JavaScript comments and values such as undefined or NaN.

The validator reports a line and column with a helpful syntax message. Jump to error selects the location. It does not silently repair or rewrite invalid input.

Syntax validation, schema validation, and exact data

Valid syntax does not prove that an API accepts a document. Required fields and allowed values need an API contract or JSON Schema Doctor. Several objects on separate lines are JSON Lines, not one document.

Formatting copies original tokens rather than serializing JavaScript numbers. 9007199254740993, 10.50, 1E2, string escapes, and every duplicate key survive unchanged. Other parsers may round an ID or keep only the last duplicate value. Try the exact-number example ↗ and read why JSON numbers change and duplicate keys disappear. See RFC 8259 for interoperability rules.

Open files up to 10 MiB; nesting is bounded at 128 levels and formatted output at 20 MiB. Large inputs switch to text-only display for responsive scrolling. The complete text remains searchable, copyable, and downloadable.

Share a JSON debugging example

Formatting happens locally without uploading pasted JSON. To share, select Share JSON and choose either an embedded-data URL or a stored short link. The embedded URL includes the data in its fragment; the short-link option explicitly stores it for 30 days. Anyone with either link can read the example, so replace secrets and personal values first.

For before-and-after payloads, use the JSON diff checker. To move records into a spreadsheet, use JSON to CSV; for configuration formats, try JSON to YAML. If the payload begins with H4sI, follow the Base64 GZip to JSON guide before formatting it.

Learning JSON, REST APIs or system design for an interview? You can turn your study notes into AI-generated quizzes on Synapticz, then revisit the questions you missed on a spaced-repetition schedule.

Frequently asked questions

How do I format and validate JSON online?

Paste JSON or open a local file, choose two spaces, four spaces, or tabs, and select Prettify. Compact minifies it; Validate checks syntax without changing the input. Errors show a line and column with a jump action. Undo restores the text before formatting.

What is the difference between a JSON formatter and a JSON validator?

Formatting makes valid JSON easier to read. Syntax validation checks quotes, commas, brackets, and JSON values. This formatter does both, but it does not validate a document against a JSON Schema or an API contract.

Will formatting round large integers or remove duplicate keys?

No. Prettify and Compact change only whitespace between tokens. Exact numeric digits, decimal zeros, exponents, string escapes, key order, and duplicate keys are preserved. Duplicate keys and large integers receive interoperability notes because another parser may discard or round them.

How do I copy a path from the JSON tree?

Select a key or value, then use the selected-value panel to copy a jq accessor, a JSON Pointer, or the exact JSON value. Long arrays load in batches of 50; the tree displays at most 1,500 values. Files up to 10 MiB and nesting up to 128 levels are supported; large documents use a text-only editor with line numbers and search.

Is my JSON uploaded when I use the formatter?

Formatting, validation, and tree rendering happen in your browser without uploading the input. Sharing is optional: an embedded link contains the data in its URL fragment, while the short-link option explicitly stores it. Anyone with a shared link can read its data.