JSON Formatter
Run parsing, conversion, and validation in your browser. No input is sent to a server. Use it for first-pass format troubleshooting.
Status
Runs in your browser. No input is sent to a server. Use this as a first-pass diagnostic step.
How to use
Paste JSON, run “Validate” first, then use “Pretty / Minify” depending on your purpose.
Notes (this tool)
- JSONC (comments/trailing commas) is not supported. Paste valid standard JSON.
- “Sort keys” is for readability/diffing. Disable it when key order carries meaning.
About this page
What does this tool do?
Paste JSON (object/array) and format it (indent), minify it (remove whitespace), or validate its syntax.
Use it to make JSON readable, reduce size, or quickly locate parse errors.
Debugging workflow (recommended)
- Run Validate first to confirm syntax status
- If valid, use Pretty to inspect structure
- Use Minify for distribution-size optimization
- Enable key sort only when it helps diff comparisons
Recommendations (practical)
- Do not assume sorted keys in production APIs (can affect signatures/comparisons)
- Use Pretty for review and Minify for transport
- Re-run Validate after fixes to prevent regressions
What this tool does
- Pretty: outputs JSON with indentation
- Minify: removes whitespace/newlines
- Validate: shows syntax errors
- Optional: key sorting (pretty only)
Common pitfalls
- Using single quotes, trailing commas, or comments in standard JSON
- Treating very large integers as numbers and losing precision
- Using duplicate keys and missing parser-dependent behavior differences
Operational notes
- The same string can be interpreted differently by context. Prioritize destination specifications.
- Watch for upstream auto-conversion such as spaces, line breaks, and URL decoding.
Referenced specs
- RFC 8259 (JSON)
- ECMA-404 (The JSON data interchange syntax)
- RFC 8785 (JSON Canonicalization Scheme)
- No comments/trailing commas (not JSONC)
FAQ
Does it support JSON with comments (JSONC)?
This tool targets standard JSON only. Remove comments/trailing commas before pasting.
Will key order be preserved?
Usually yes, but enabling “sort keys” will reorder them alphabetically.
Why does Validate fail even when it looks like JSON?
Single quotes, trailing commas, comments, and NaN/Infinity are invalid in standard JSON. Check for JSONC/JSON5-style syntax.
Does Minify change semantics?
Normally no; it removes whitespace/newlines only. Invalid source data may fail processing.
References
Next to view (diagnostic order)
These links are generated from site_map rules in recommended diagnostic order.
- JSONC Formatter — Format and validate JSONC (comments/trailing commas)
- JSON Diff — Compare two JSON documents and show diffs
Example
{"a":1,"b":[true,false]}