JSON Formatter

Format, validate and beautify JSON for free.

This tool runs entirely in your browser. Your files are never uploaded to a server.

{
  "hello": "world"
}

What this tool does

Parses the JSON you paste, then re-serializes it as either pretty-printed (2-space indented) or minified (single-line) output. If the input isn't valid JSON, it shows the parser's own error message instead of a formatted result.

How to use it

Paste or type JSON into the input box. The formatted result appears automatically as you type — there's no separate "format" button to click. Toggle "Minify output" to switch between an indented, readable version and a compact single-line version, then copy the result with the copy button.

Worked example

Pasting {"name":"Ada","active":true,"tags":["dev","admin"]} produces a readable JSON object indented with two spaces, including the nested "tags" array. Checking "Minify output" collapses it back to the original single-line form, with spacing normalized.

What counts as valid JSON

The formatter uses the browser's built-in JSON parser, so it follows the JSON specification exactly: keys must be double-quoted strings, trailing commas are not allowed, and single quotes, comments and unquoted keys — all common in JavaScript object literals — are rejected. If your input includes any of these, fix it according to the browser's own error message.

Formatting vs minifying

Pretty-printing adds two-space indentation and newlines so nested objects and arrays are easy to scan. Minifying removes that whitespace to produce the smallest valid representation, which is what most APIs expect on the wire and what shrinks a config file for storage or transfer.

Limitations

This tool formats and validates syntax only — it does not check the data against a JSON Schema, detect duplicate keys, or verify that particular fields exist. It re-serializes through JavaScript's JSON.parse/JSON.stringify, so very large numbers beyond JavaScript's safe integer range can lose precision, matching the behavior you'd see in most JavaScript-based tooling.

Scope, sources and privacy

This tool follows the JSON specification (ECMA-404 / RFC 8259) via the browser's native JSON parser. Formatting and minifying run entirely in your browser; the JSON you paste is never uploaded or sent to a server.

Frequently Asked Questions

Does it validate my JSON?
Yes, invalid JSON shows a clear error message pointing to the problem.
Can I minify JSON too?
Yes, there's a toggle to switch between pretty-printed and minified output.
Is my JSON sent to a server?
No, formatting happens entirely in your browser.