JSON Formatter
Beautify, minify or validate JSON
How it works
JSON Formatter — Beautify, minify or validate JSON. All processing happens in your browser — no upload, no signup, no email required. Free forever.
Last updated:
About JSON Formatter
JSON Formatter beautifies, minifies and validates JSON payloads in your browser. Whether you need pretty-printed JSON for a code review or one-line minified JSON for a config file, the tool does it instantly without sending data to a server.
Backend developers paste API responses to inspect their structure, QA engineers verify webhook payloads, and data analysts clean up exported JSON before importing into a script. The fullscreen mode is especially useful when reviewing deeply nested objects.
The validator surfaces parse errors with a clear message so you can fix malformed JSON quickly — perfect for hunting down a missing comma or unescaped quote.
How to use JSON Formatter
- Paste your JSON into the Paste JSON input area on the left.
- Click Beautify to pretty-print, or Minify to collapse onto one line.
- Pick an indent setting — 2 spaces, 4 spaces or single line — to match your project's style.
- If the input is malformed, read the red error to locate the parse problem and fix it in the input.
- Click Copy on the Formatted JSON output to send the result to your clipboard, or open Fullscreen for a roomier view.
Common use cases
- Inspecting a verbose REST API response by reformatting it into a readable, indented structure.
- Preparing config files (package.json, tsconfig.json, app manifests) by minifying or normalising indentation.
- Validating that a webhook payload matches the expected JSON shape before forwarding it to your backend.
- Cleaning up Postman or curl output to paste into bug reports or pull requests.
- Stripping whitespace from JSON before embedding it in a HTML data-attribute or environment variable.
Tips & common mistakes
- If you see an error like "Unexpected token } in JSON at position 142", the problem is usually a trailing comma just before that brace.
- JSON keys must be wrapped in double quotes — single quotes are a common JavaScript-vs-JSON mistake.
- For very large payloads (megabytes), use the fullscreen mode and rely on collapse arrows to navigate instead of scrolling.
- Minified output works great for storage, but always re-beautify before committing to git so diffs stay reviewable.
Frequently asked questions
Does it validate my JSON?
Yes. If the input is invalid, you'll see a red error message with the parse error details, and no output is shown.
Does it support comments or trailing commas?
No. Strict JSON only — comments and trailing commas are not allowed by the JSON spec. Use JSON5 if you need those.
Can I collapse large objects to focus on a section?
Yes. Click the chevron next to any object or array to collapse it. The full screen toggle gives you maximum space for big payloads.
Does JSON beautifying change the meaning of my data?
No. Beautify and Minify only change whitespace; the parsed object is identical. Numbers, strings and key order all stay the way they were.
Why does my JSON with NaN or Infinity fail to parse?
The JSON specification does not allow NaN, Infinity or undefined as values — those are JavaScript-only. Replace them with null, or wrap them as strings if you need to round-trip through a non-JS system.
Can I sort the keys alphabetically?
Not directly in this tool. After beautifying, paste the result into a small Node.js or Python snippet that does JSON.stringify(obj, Object.keys(obj).sort()) — sorting keys can change semantic meaning in some APIs, so we keep them as-authored by default.