Developer Tools

JSON formatter

Turn raw JSON into a clean, readable format and catch syntax errors before you ship.

Best for: Inspect API responses, Clean copied configuration

Quick answer

Paste JSON, choose an indent size, and get a readable, validated result with syntax errors shown clearly.

Overview

This JSON formatter parses pasted JSON and renders it with consistent indentation so nested objects and arrays are easy to inspect. It also produces a compact minified version, which is useful when you need to compare structure or move data between systems. If the input is not valid JSON, the tool reports the parsing problem instead of guessing. That makes it suitable for debugging API responses, cleaning copied snippets from logs, and reviewing configuration files before they are committed. The output keeps the data structure intact while changing presentation only. Objects stay objects, arrays stay arrays, and numbers, booleans, null values, and strings remain exactly as parsed.

Use cases

  • Inspect API responsesReformat nested response bodies so status fields, pagination data, and arrays are easier to scan during debugging.
  • Clean copied configurationTurn dense settings blocks into readable JSON before comparing values or moving them into a repository.
  • Prepare payloads for sharingSwitch between formatted and compact JSON when sending examples to teammates or pasting into documentation.

How it works

  1. 1

    Paste a JSON document into the input field.

  2. 2

    Select the indentation width you want for the formatted view.

  3. 3

    The parser checks whether the text is valid JSON and returns a clear error if it is not.

  4. 4

    When the input is valid, the tool shows the prettified JSON, a minified version, and the line count.

Examples

Read a webhook payload

Input: {"event":"invoice.paid","data":{"id":4821,"amount":1299,"currency":"USD"}}

Output: { "event": "invoice.paid", "data": { "id": 4821, "amount": 1299, "currency": "USD" } }

Expands a nested event payload into a structure that is easier to review field by field.

Compact a settings object

Input: { "theme": "dark", "layout": { "sidebar": true, "density": "comfortable" } }

Output: {"theme":"dark","layout":{"sidebar":true,"density":"comfortable"}}

Removes whitespace to create a smaller version while preserving the same data.

Catch an invalid comma

Input: {"name":"Mira", "roles":["admin",], "active":true}

Output: Error: Unexpected token ] in JSON at position 36

Shows the syntax issue so the bad comma can be fixed before the payload is used.

FAQ

Does formatting change the actual JSON values?

No. Formatting changes spacing and line breaks only. Strings, numbers, booleans, null values, arrays, and objects keep the same content.

Will the formatter preserve key order?

It keeps the order returned by the parser, which matches the input order in normal JSON objects. It does not sort keys unless your source is already ordered that way.

Can it repair broken JSON automatically?

No. If the input is invalid, the tool reports the parse error rather than guessing at missing quotes, commas, or brackets.

Why do I see an error on trailing commas?

Trailing commas are not allowed in standard JSON. Remove the extra comma after the last item in an array or object.

How should I read the minified output?

The minified version is the same data without extra whitespace. It is useful for copying into tests, payload samples, or transport logs, but it is harder to read by eye.