{ }jsonkit
Format
Validate
Convert
Query
Generate

JSON5 and JSONC to JSON converter

Strip comments and trailing commas to get strict JSON.
Indent
237 B · paste or drop a file
1 2 3 4 5 6 7 8 9 10 11 12
✓ complete237 B → 181 B0.0 ms

About JSON5 / JSONC to JSON

The JSON5 to JSON converter turns relaxed JSON5 or JSONC into strict JSON that any parser accepts. It handles comments, trailing commas, single-quoted strings, unquoted keys and hex numbers, the syntax you find in tsconfig.json, VS Code settings and Babel configs.

Use it when a strict parser throws "Unexpected token" on a commented config. Pick 2 or 4 spaces of indentation and copy the result. Runs in your browser. Nothing is uploaded.

How it works

Comments are stripped

Both // line comments and /* block */ comments are removed. JSON has no comment syntax, so the output holds only data, as an RFC 8259 parser expects.

Trailing commas, single quotes and unquoted keys

Trailing commas after the last element or property are removed. Single-quoted strings become double-quoted, and unquoted keys like { name: 1 } get quotes. The data stays the same.

Hex and loose numbers

Hex literals like 0x1F become their decimal value (31). Loose forms such as .5 and 5. become 0.5 and 5. JSON cannot express hex or a leading or trailing dot, so each number is written in standard JSON form.

Precise errors and clear limits

Malformed input reports the first syntax error with its line and column. Infinity and NaN are valid JSON5 but have no JSON form, so they are reported as errors instead of being silently changed.

Frequently asked questions

What is the difference between JSON5 and JSONC?

JSONC (JSON with Comments) is JSON plus // and /* */ comments and trailing commas. VS Code uses it for settings and tsconfig.json. JSON5 goes further and adds single quotes, unquoted keys, hex numbers and more. This tool accepts both.

Can I convert my tsconfig.json or VS Code settings.json?

Yes. Those files are JSONC, with comments and trailing commas that strict parsers reject. Paste the file here to get JSON any standard parser accepts.

Is my config uploaded anywhere?

No. The conversion runs in your browser and works offline.

Why does Infinity or NaN cause an error?

JSON5 allows Infinity and NaN, but JSON has no way to represent them. The converter reports them as an error with the exact position instead of writing invalid output.

Do comments survive the conversion?

No. Standard JSON does not support comments, so they are removed. Keep the original JSON5 or JSONC file as your source if you need the notes.

Sources & last verified

We checked this tool's behavior and the claims on this page against the specifications below on . The tool runs in your browser, so the output you see is exactly what the engine produced.

Found a wrong result or an outdated claim? Report an error and we will check it again.