Why deleting comment text can break a configuration
Use quoted URLs, duplicate keys and large identifiers to understand a reliable JSONC handoff.
A URL contains slashes that are data
In the example, // inside the quoted URL must survive while the adjacent block comment is removed. Splitting a line at // would truncate the string. The converter recognizes tokens before removing syntax.
{"url":"https://example.org/a//b",/* note */"id":9007199254740993,"items":[1,2,],}Duplicate keys make a handoff ambiguous
Two keys spelled "id" and "\u0069d" refer to the same decoded key. Rather than choosing the first or last value, this tool refuses the object. The original question also contains malformed syntax; removing comments cannot repair a missing comma or a broken string.
- Keep the original configuration.
- Resolve repeated keys with the configuration owner.
- Open the strict JSON in its actual consumer.
Number spelling and reader precision are separate
Original numeric tokens, including large integers, decimal exponents and negative zero, stay byte-for-byte in the output. A consuming application may still round them; choose a reader with suitable precision.
The compact result omits comments, whitespace and trailing commas. Keys, strings, array order and number spellings are retained; this is syntax conversion, not configuration validation. Files and contents stay in this browser.
| Input | Output |
|---|---|
| 9007199254740993 | 9007199254740993 |
| -0 | -0 |
| 1e400 | 1e400 |
| /* note */ | Removed comment |
Use the supported dialect
Accept standard JSON values with // line comments, /* block comments */ and trailing commas. JSON5 single quotes, unquoted keys, hexadecimal numbers, NaN, Infinity and executable expressions are rejected.
Correct the indicated syntax, use double-quoted keys and strings, and remove duplicate keys. Select a supported UTF-8 file or clear the file selection to use pasted input.
References
- C-style comment configuration question
The original author needs generated commented data to work with a standard parser. The posted malformed sample is not automatically repaired; browser preference and demand scale remain unknown.
- Microsoft JSONC scanner and tree parser
Scanner errors and parse errors must both be empty; decoded duplicate object keys are additionally refused.
Tools in this category
Expand a tool to see its steps, options and supported formats, then open its workspace.
JSON with comments to JSONRemove JSONC comments and trailing commas while preserving every original JSON number token.
Paste a commented configuration or select one UTF-8 file, then download strict JSON and its conversion report.
Steps
- Paste JSONC or select your original UTF-8 configuration.
- Convert and review the removed-comment and trailing-comma counts.
- Download converted.json and conversion-report.json.
- Open the JSON in the intended application and check its numeric handling.
Capabilities and limits
- Paste up to 1 MiB or select one UTF-8 file up to 2 MiB; a selected file takes priority over pasted text. One leading UTF-8 BOM is removed and recorded.
- Accept standard JSON values with // line comments, /* block comments */ and trailing commas. JSON5 single quotes, unquoted keys, hexadecimal numbers, NaN, Infinity and executable expressions are rejected.
- Reject malformed syntax and duplicate decoded keys in each object. No missing comma, broken string or invalid escape is automatically repaired.
- At most 128 nested containers and 200,000 non-comment syntax tokens. Strict JSON is limited to 4 MiB; accepted source limits dominate that output guard.
- Original numeric tokens, including large integers, decimal exponents and negative zero, stay byte-for-byte in the output. A consuming application may still round them; choose a reader with suitable precision.
- The compact result omits comments, whitespace and trailing commas. Keys, strings, array order and number spellings are retained; this is syntax conversion, not configuration validation. Files and contents stay in this browser.
- The screen previews the first 4,000 characters; copy and download keep the complete result.