JSON Formatter
Format, minify, and validate JSON in one place.
Why use this tool
01Parse and transform JSON payloads locally in the browser.
JSON Formatter helps clean and validate JSON payloads before using them in APIs, configs, and logs.
All parsing and formatting runs in your browser tab.
How to use
02Quick checks before you copy
03Confirm the input is the format you intended.
Scan the result before using it in a document, URL, config, or message.
Copy only the output you need.
Use Cases
Paste a minified JSON response from an API into the formatter to quickly read its structure and find the field you need.
Check that a JSON configuration file (webpack, tsconfig, package.json) is well-formed before committing.
Format raw webhook or event payloads from services like Stripe, GitHub, or Slack to understand their structure.
Beautify a JSON example before pasting it into API documentation, a README, or a Confluence page.
Format two JSON objects side-by-side to visually compare their keys and structure.
Remove whitespace from formatted JSON to minimize payload size before embedding in code or sending over a network.
Tips & Tricks
- 01Paste from browser DevTools
In Chrome DevTools, right-click any network response and choose 'Copy Response'. Paste directly into the formatter — no cleanup needed.
- 02Use minify mode for inline code
When embedding JSON in JavaScript or a config string, use the Minify option to collapse whitespace before copying.
- 03Syntax errors are highlighted
If your JSON is invalid, the formatter highlights the problem line. Common issues: trailing commas, single quotes instead of double quotes, missing colons.
- 04Set indent to 2 spaces for most use cases
Two-space indentation is the most widely used convention and matches the output of JSON.stringify(obj, null, 2) in JavaScript.
FAQ
04Is my JSON sent to a server?
No. All formatting and validation happens in your browser. JSON containing credentials, tokens, or private data stays on your device.
Why does the formatter show an error on valid JSON?
JSON is stricter than JavaScript object syntax. Common issues are trailing commas after the last key/value pair, single-quoted strings, or JavaScript comments — none of which are valid JSON.
Can I format extremely large JSON files?
Yes, for files up to a few MB. Very large files (50MB+) may slow down browser-based formatting due to memory constraints.
What's the difference between formatting and validation?
Formatting adds whitespace for readability. Validation checks whether the JSON is syntactically correct. This tool does both simultaneously.
Can I collapse specific keys in the formatted output?
Currently the tool outputs fully expanded or fully minified JSON. Partial collapsing is not supported.
Can I sort JSON keys alphabetically?
Yes. Use the Sort Keys option to alphabetically sort all object keys, making it easier to compare similar JSON objects.
Does the formatter support JSON5 or JSONC?
The formatter targets strict JSON (RFC 8259). JSON5 and JSONC (with comments) are not supported.
How do I fix 'Unexpected token' errors?
This usually means there's a stray character, an unescaped quote inside a string, or a JavaScript-style property without quotes. Check the highlighted line for the specific issue.
Related tools
03JSON ↔ YAML Converter→
Convert between JSON and YAML using the standard js-yaml library — both directions, configurable indent, safe-by-default.
JSON Schema Generator→
Infer a JSON Schema from a sample JSON document, with draft selection and required policies.
JSON Diff Checker→
Compare two JSON values structurally — added, removed, changed keys per nested path. Order-insensitive.