About JSON5 to JSON Converter
Configuration files such as tsconfig.json, VS Code settings and Babel configs allow comments and trailing commas, and JSON5 files go further with unquoted keys, single quotes and hexadecimal numbers. Most JSON parsers reject all of that. Paste the file here and get plain JSON that any program accepts.
The input is read by the JSON5 rules, which cover JSON with comments too. A syntax error is reported with its line and column, and numbers that strict JSON cannot hold, such as Infinity, are pointed out rather than changed in silence.
How it works
- The text is parsed by the json5 library, which accepts // and /* */ comments, trailing commas, unquoted keys, single-quoted strings, strings continued over lines, hexadecimal numbers, leading or trailing decimal points and a + sign.
- The parsed data is written back with JSON.stringify, indented as you choose or minified, and optionally with every object’s keys sorted A to Z.
- Infinity and NaN, which JSON5 allows and JSON does not, are written as null, and integers beyond 2^53 lose their last digits. The result says how many there were.
Questions
Are the comments kept anywhere?
No. Strict JSON has no comments, so they are removed. Keep the original file if you want to edit them later.
What happens to a key that appears twice?
The last value wins, as in JavaScript, and the earlier one is dropped without a warning. Check long files with the JSON Validator if repeated keys may matter.
Is there a size limit?
The input can be up to 5 MB, nested up to 500 levels deep.
Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.