JSONC to JSON
Convert commented JSON to strict JSON while preserving quoted strings and exact numeric tokens locally.
This tool processes its input contents in your browser instead of sending them to a processing service. Page, asset and fixed usage-measurement requests are described on the Privacy page.
Remove comments and optionally trailing commas from JSONC, then validate and format strict JSON without rounding numeric tokens.
How to use it
- 1Paste commented JSON or open a UTF-8 file.
- 2Choose whether trailing commas should be removed or rejected.
- 3Convert, inspect the removal counts and keep the strict JSON result.
Example
- Input
- {"n":1,/*note*/}
- Output
- { "n": 1 }
What happens to your data
Comment scanning, parsing and output generation are local. Configuration values and comments are not sent to a processing server.
Last updated November 2026
Configuration files may accept comments even when an API, validator or build step requires strict JSON. Convert JSON with // line comments or /* block comments */ into ordinary JSON, with an explicit choice to remove or reject trailing commas. Quoted URLs and comment-like text inside strings are retained. The result can be copied or downloaded without uploading the configuration.
How it works
A string-aware scan distinguishes comments from characters inside double-quoted JSON strings. Comments are replaced with whitespace while line boundaries are retained for subsequent syntax checking. If trailing-comma removal is enabled, a comma before a closing object or array delimiter is removed outside strings. The cleaned document is then parsed and formatted as strict JSON. This second step rejects malformed structures instead of treating comment removal as successful validation.
Numbers are kept as numeric tokens, so a long integer or a carefully specified decimal does not pass through a floating-point round trip. The result reports how many comments and trailing commas were removed. Comments are discarded, not migrated into fields or a side file. Keep your original configuration if those explanations matter.
JSONC conventions differ across applications. This converter handles comments and optional trailing commas only. It does not evaluate JavaScript, accept single-quoted strings, invent quotes around unquoted keys, repair missing values or support JSON5 features such as hexadecimal numbers. An unclosed comment, duplicate property name or invalid JSON produces an error. Use up to 128 KiB,24nesting levels and5,000 values. Changing the source invalidates an earlier result, including while a local file is still being read.
Common use cases
- Convert a commented editor configuration into an API fixture.
- Remove explanatory comments before running a strict JSON validator.
- Preserve long numeric IDs while turning a JSONC export into standard JSON.
Frequently asked questions
Will URLs containing//be damaged?+
No. Comment markers inside double-quoted strings are retained as string content.
Does it support JSON5?+
No. Single quotes, unquoted keys, expressions and non-JSON numeric syntax are rejected.
Can I keep trailing commas?+
Strict JSON does not allow them. Choose removal or choose rejection to require correction in the source.
Can removed comments be recovered from the output?+
No. Keep the original file if you need its comments. The downloaded result contains strict JSON only.
Standards and limitations
Related tools
vCard Generator
Create a UTF-8 vCard 4 contact file with safe folding and download it locally.
Subtitle Converter
Convert plain SRT and WebVTT locally, with cue previews and no silent metadata loss.
ZIP Creator
Create a ZIP locally with editable archive paths, Store or Deflate compression, and exact file bytes.
JSON ⇄ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON.