JSON Formatter

Prettify, minify, or validate JSON. All processing happens in your browser.

JSON · format · validate · minify

A free, privacy-first JSON formatter that pretty-prints, minifies, and validates JSON entirely in your browser. Paste an API response or config file, fix syntax issues, and copy clean output without uploading data to a third-party server.

Pretty-print & minify Syntax validation Parse error hints 100% client-side No sign-up

What this tool does

JSON is the default interchange format for REST APIs, webhooks, package manifests, and many infrastructure configs. Humans rarely want the one-line minified form that travels over the wire. This tool rewrites valid JSON with consistent indentation so nested objects and arrays are readable, compresses it back to a single line when you need a smaller payload, and reports whether the input is legal JSON according to the language standard (not “JSON-like” JavaScript).

Under the hood it uses the browser’s native JSON.parse and JSON.stringify. That means the same rules your front-end and many runtimes use: double-quoted keys and strings, no trailing commas, no comments, and no bare undefined.

How to use it

  1. Paste or type JSON into the Input panel (or use Paste).
  2. Click Format to pretty-print with 2-space indentation, Minify for a single line, or Validate to check syntax only.
  3. Read the status bar for success or a parse error (including position when the engine provides it).
  4. Use Copy to move the result into your editor, ticket, or terminal. Shortcut: Ctrl+Enter formats from the input box.

When to use a browser formatter

Common JSON mistakes this catches

SymptomLikely causeFix
Unexpected token 'Single-quoted strings (JS, not JSON)Use double quotes
Unexpected token ,Trailing comma after last property/elementRemove the comma
Unexpected token / or #Comments (JSONC / JSON5)Strip comments or use a JSONC-aware tool
Unexpected non-whitespaceTwo values, or text after the root valueOne root value only
Unexpected end of JSONTruncated response or missing }/]Complete the structure

Tip: Formatting only changes whitespace (and may reorder object keys according to the engine). Values and types are preserved for valid JSON. It does not “fix” invalid input — validation fails until the text is legal JSON.

Example

Minified input:

{"user":{"id":42,"roles":["admin","editor"]},"active":true}

Formatted output:

{
  "user": {
    "id": 42,
    "roles": [
      "admin",
      "editor"
    ]
  },
  "active": true
}

Limitations

FAQ

Does formatting change my data?

Pretty-printing changes whitespace only. Number values stay numbers; strings stay strings. Key order may follow JSON.stringify rules in your browser.

Why do trailing commas fail?

Standard JSON forbids trailing commas. Many JS style guides allow them in object literals, but JSON.parse will reject them. Remove the extra comma or convert from JSONC separately.

Is my JSON uploaded to DevToolBox?

No. Parse and stringify run locally in your browser. See our Privacy Policy.

Can I format JSON Lines (NDJSON)?

Not as a multi-line stream in one pass. Format each line as its own JSON document, or use a dedicated NDJSON tool.

Related tools

Sponsored