JSON5 / JSONC to JSON

Input
Output

JSON5 and JSONC to JSON

Config files often use JSON with comments (JSONC, as in VS Code and tsconfig) or JSON5. Bracely reads them and writes standard JSON any parser will accept, or writes JSON back as tidy JSON5.

Example: a dev server config with comments

A JSON5 config with comments, unquoted keys, single quotes, a hex number and trailing commas. JSON.parse rejects every one of those; the converted version loads anywhere:

Input

{
  // dev server
  port: 8080,
  host: 'localhost',
  features: ['auth', 'search',],
  maxBody: 0x100000, // 1 MB
  /* turn off in production */
  debug: true,
}

Output

{
  "port": 8080,
  "host": "localhost",
  "features": [
    "auth",
    "search"
  ],
  "maxBody": 1048576,
  "debug": true
}

How do I use the JSON5 / JSONC to JSON?

  1. Paste JSON5 or JSONC.
  2. Get standard JSON in the Output box.
  3. Copy it or save it.

What does the JSON5 / JSONC to JSON do?

  • Comments, trailing commas and single quotes
  • Unquoted keys and hex numbers
  • Switch direction to write JSON5

When to use the JSON5 / JSONC to JSON

Many config files aren't strict JSON. tsconfig.json, VS Code's settings and .eslintrc allow comments and trailing commas (JSONC), and JSON5 also allows unquoted keys, single quotes, hex numbers and a leading + or . on numbers. JSON.parse, jq and most JSON libraries reject all of that, so convert the file when a tool or a script needs standard JSON.

Comments are removed, keys and strings get double quotes, hex numbers become decimal and trailing commas go. JSON has no NaN or Infinity, so those become null. Switch Direction to write JSON as tidy JSON5, with unquoted keys where that's allowed, single quotes and trailing commas, for config files people edit by hand.

Frequently asked questions

Are comments kept?
No. Standard JSON has no comments, so they're dropped. Keep the JSON5 or JSONC file as the source and convert a copy when a tool needs plain JSON.
What's the difference between JSON5 and JSONC?
JSONC is JSON plus comments (and, in VS Code, trailing commas). JSON5 goes further: unquoted keys, single-quoted strings, hex numbers and multi-line strings. Bracely reads both.
Can it read tsconfig.json?
Yes. tsconfig and VS Code settings are JSONC, which this tool reads.
Is my data uploaded?
No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.

More JSON tools

Bracely has 108 JSON tools in one page. Related ones:

Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.7 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram