Zero Signup ToolsFree browser tools

Converter Tools

JSON5 to JSON Converter

Convert JSON5 and JSONC (JSON with comments) to strict JSON. Strips comments, trailing commas, single quotes, and unquoted keys in your browser.

460 chars
Or try a sample

Strict JSON output

342 chars
6 changes applied

Options

Output indent

Infinity and NaN handling

How to use

  1. Paste your JSON5 or JSONC text into the input box on the left. The bundled samples cover tsconfig.json, JSON5 with unquoted keys, and JSONC with trailing commas.
  2. Pick the output indent: 2 spaces, 4 spaces, tab, or minified for a single-line result.
  3. Choose how to handle Infinity and NaN. Convert to null keeps the output valid JSON, Convert to string preserves the original intent as a label, and Treat as error refuses to convert.
  4. Use Copy JSON or Download .json to save the result. The Changes panel lists how many comments, trailing commas, single quotes, unquoted keys, and hex numbers were normalized.
  5. If the input has a syntax error, the right panel shows the precise line and column. Fix the issue and the output updates as you type.

About this tool

JSON5 to JSON Converter turns the loose, developer-friendly JSON dialects (JSON5 and JSONC) into strict RFC 8259 JSON that any parser accepts. Paste a config from tsconfig.json, VS Code settings.json, .babelrc, .eslintrc.json, devcontainer.json, GitHub Copilot settings, or any file with comments and trailing commas, and a clean strict-JSON version appears on the right. The converter recognizes the full JSON5 grammar: line comments (// ...), block comments (/* ... */), trailing commas in objects and arrays, single-quoted strings, unquoted identifier keys, hex numbers like 0xff, numbers that start or end with a decimal point (.5 and 5.), explicit + signs, Infinity, -Infinity, NaN, and the standard escape sequences plus \x hex escapes and line continuations. Non-standard numbers (Infinity, NaN) get a dedicated handler: replace them with null, replace them with their string forms ("Infinity", "NaN"), or refuse to convert. The output side shows a side-by-side strict-JSON view with copy and download controls, your chosen indent (2 spaces, 4 spaces, tab, or minified), and a Changes panel that reports how many comments, trailing commas, single-quoted strings, unquoted keys, and hex numbers were normalized. An Extracted comments panel collects every stripped comment in document order so you can save them to a separate notes file before throwing them away. Parse errors include a precise line and column so you can find broken bracket pairs and unterminated strings without scrolling. Everything runs in the browser. Your config files, secrets, and source-tree paths never leave your device. Useful for converting tsconfig to a strict JSON tooling expects, prepping a JSONC file for a parser that does not understand comments, generating clean output for an HTTP API that requires JSON, lifting a JSON5 fixture into JSON, and quickly sanity-checking a config you copy-pasted from a tutorial.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsConverter Tools