← Back to Home

JSON Formatter

Validate, format, and minify JSON data.

About this tool

The JSON Formatter validates, beautifies, and minifies JSON entirely in your browser. Paste a raw API response and get indented, syntax-highlighted output with any parse errors pointed to exactly, no round-trip to a server, no payload leaving your machine. It's the tool you want open when you're debugging a webhook payload, inspecting a third-party API, or cleaning up a config file before committing it.

Use it when JSON arrives as a single minified line and you need to read it, when you're writing JSON by hand and want to verify it parses before deploying, or when you want to shrink a bloated payload for embedding in a URL, cookie, or environment variable. Pretty-print for humans, minify for wire format, both operations are a single click on the same input.

What it does

Parses JSON according to RFC 8259 (strict JSON, no comments or trailing commas), reformats it with 2-space indentation, or strips every byte of whitespace for minified output. Errors include the line and column of the first parse failure so you can fix the input fast.

When to use it

Daily dev work: debugging API responses, preparing seed data, reviewing logs, or validating that a config file is well-formed before running a deploy. Pair with the Encoding Converter when the JSON is wrapped in Base64, and the Unix Timestamp tool when the payload contains epoch time values that need human translation.

Frequently asked questions

How do I format a minified JSON string?
Paste it into the input field and the formatted, indented version appears in the output, no button press required. The formatter uses 2-space indentation by default, which matches the style used by most APIs and linters.
Why is my JSON invalid?
Most common reasons: single quotes instead of double, trailing commas after the last element of an array or object, unquoted keys, or unescaped special characters inside strings. The formatter points to the exact line and column where parsing failed.
How do I minify JSON?
Use the Minify option to strip all whitespace and produce a single-line string suitable for embedding in a query parameter, cookie value, or API body where payload size matters. Minifying a typical 10 KB formatted payload saves around 20-30% of bytes.
Is the JSON I paste sent to a server?
No. All parsing, formatting, and minifying runs locally in your browser with JavaScript's built-in JSON methods. You can safely paste payloads containing API tokens or secrets for local debugging.
Can I format JSON5 or JSONC?
Not directly. The formatter validates strict JSON only (RFC 8259). If you're working with JSONC (JSON with comments, used by VS Code settings) or JSON5 (trailing commas, unquoted keys), strip those extensions first or the parser will reject them.
What's the difference between a JSON object and array?
An object is a collection of key-value pairs wrapped in {} with string keys. An array is an ordered list wrapped in []. Both can be nested arbitrarily deep. APIs usually return one or the other at the top level. Check the opening character to know which you're dealing with.