Input
Output
Ready

How to use the JSON Formatter

Paste a JSON object, array, string, number, boolean, or null into the input panel. Click Format to pretty-print it with two spaces, four spaces, or tabs. Click Minify to remove whitespace and produce compact JSON for transport, storage, or test fixtures.

The validator uses the browser JSON parser and reports readable syntax hints. This is useful when debugging API responses, webhook payloads, package metadata, copied log fragments, and configuration files.

Guide: If you are working with a raw API payload, read how to format and validate a JSON API response for a full walkthrough with examples and common parse errors.

Practical JSON examples

API response: format payloads such as {"user":{"id":42,"roles":["admin","editor"]},"active":true} so nested fields are easier to inspect.

Compact config: minify formatted JSON before pasting it into an environment variable, curl command, or small documentation example.

Error cleanup: if copied data contains trailing commas, comments, single-quoted keys, or text before the opening brace, clean those parts before validating.

Common JSON problems

JSON requires double-quoted property names, no trailing commas, no comments, and valid escape sequences. JavaScript object syntax, JSONC, and log output may look similar but are not always valid JSON.

FAQ

Can this formatter fix invalid JSON automatically?

No. It validates and reports parser errors, then formats valid JSON. Remove comments, trailing commas, single-quoted keys, or extra log text before formatting.

What JSON values can I paste?

You can paste a JSON object, array, string, number, boolean, or null. Objects and arrays are the most common payloads for APIs and config files.

Does the formatter sort object keys?

No. It preserves the property order returned by the browser JSON parser instead of changing your payload order.

Why does a trailing comma fail?

Trailing commas are valid in some JavaScript object literals, but they are not valid in standard JSON.