JSONC 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.
Output is standard JSON (comments removed), ready for downstream systems.
How to use
Paste JSONC, validate syntax first, then use Pretty/Minify to convert into standard JSON as needed.
Notes (this tool)
- JSON5 extensions (single quotes, unquoted keys, etc.) are not supported.
- Comments are not preserved in output. Keep explanatory notes in separate documentation if needed.
About this page
What does this tool do?
Paste JSONC (JSON with comments) and pretty/minify/validate it. The output is standard JSON (comments removed).
JSONC is a “JSON-like” format that allows comments (//, /* */) and trailing commas. It is often used in configuration files (e.g., editor settings). It is not standard JSON (RFC 8259).
Debugging workflow (recommended)
- Validate first to confirm JSONC syntax
- Use Pretty to improve readability and inspect commented sections
- If standard JSON is required, use Minify/Pretty output without comments
- If downstream JSON fails, re-validate with JSON Formatter
Recommendations (practical)
- Use JSONC for human-edited config, standard JSON for machine exchange
- Generate comment-free JSON before deployment to match consumers
- Use key sorting mainly for reviews; avoid breaking meaningful order
Typical use cases
- Pretty-print a config file for readability
- Convert to standard JSON by removing comments
- Validate JSON that includes trailing commas
Common pitfalls
- Sending raw JSONC to APIs and hitting parse errors
- Confusing JSON5 syntax (single quotes/unquoted keys) with JSONC
- Forgetting comments are dropped and expecting them as data
What this tool does
- JSONC → Pretty
- JSONC → Minify
- Validate JSONC syntax (with error location)
- Optional: key sorting (pretty only)
About the output
- Output is standard JSON (comments are not preserved).
- Pretty/minify changes formatting only (same semantics).
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 / ECMA-404 (standard JSON)
- JSONC (comments/trailing commas)
- VS Code JSON with Comments (practical reference)
FAQ
Does it support JSON5?
This tool targets JSONC (comments/trailing commas). JSON5 extensions (single quotes, unquoted keys, etc.) are not supported.
Can it keep comments?
No. Comments are removed so the output is valid standard JSON.
What is the difference between JSONC and JSON5?
JSONC mainly adds comments/trailing commas. JSON5 includes broader syntax extensions (single quotes, unquoted keys, etc.).
Can I convert JSONC to standard JSON?
Yes. Output is standard JSON without comments and can be used with RFC 8259-compliant consumers.
References
Next to view (diagnostic order)
These links are generated from site_map rules in recommended diagnostic order.
- JSON Diff — Compare two JSON documents and show diffs
- JSON Formatter — Pretty-print, minify, and validate JSON
Example
{
// comment
"a": 1,
/* block */
"b": [1,2,],
}