Options
JSON with comments
Drop the file to open it
Clean JSON
The clean JSON appears here as you type.

Paste JSON that has comments in it and the clean version appears next to it as you type. The remover strips // line comments and /* */ block comments, removes trailing commas, and can turn JSON5 into standard JSON, all without touching a // inside a string like a URL. It then checks that the result is valid JSON and points to the exact line if it isn't. Everything runs in your browser.

How to remove comments from JSON

  1. Paste your JSON into the left pane, or click Open file to load a .json, .jsonc, or .json5 file such as tsconfig.json or a VS Code settings file.
  2. Read the clean JSON on the right. The badge at the top tells you whether it's valid.
  3. If there's a problem, click it in the list under the panes to jump to that line.
  4. Choose how the output should look: your original formatting, pretty-printed, or minified.
  5. Click Copy or Download .json.

What gets removed or fixed

InputOutputOption
"port": 8080, // dev only"port": 8080,Always
/* block comment */Removed, including multi-line blocksAlways
"url": "https://example.com"Unchanged, because the slashes are inside a stringAlways
[1, 2, 3,][1, 2, 3]Remove trailing commas
{name: 'Ann'}{"name": "Ann"}Fix JSON5 syntax
0xFF, +5, .5255, 5, 0.5Fix JSON5 syntax
Infinity or NaNnull, with a warningFix JSON5 syntax
# commentRemovedTreat # as a comment

Why JSON doesn't allow comments

The JSON standard has no comment syntax. Douglas Crockford left comments out on purpose so people wouldn't use them to hide parsing instructions. Strict parsers like JSON.parse in JavaScript, Python's json module, and most API servers reject any file that contains one, usually with an error like "Unexpected token /".

Many tools still read commented JSON, often called JSONC. TypeScript's tsconfig.json, VS Code's settings.json, ESLint and Babel configs, and Deno all accept it. Trouble starts when one of those files has to be read by a tool that only understands strict JSON, such as a build script, a CI step, or another language's parser. Removing the comments makes the file safe for every JSON parser.

JSONC vs. JSON5 vs. JSON

JSONC is JSON plus // and /* */ comments, and often trailing commas. JSON5 goes further, allowing unquoted keys, single-quoted strings, hexadecimal numbers, leading and trailing decimal points, Infinity, NaN, and strings that continue across lines. With Fix JSON5 syntax on, this tool converts all of those to standard JSON, which works for both formats.

Keeping your formatting

With Output set to Keep my formatting, only the comments and trailing commas are removed. Your indentation, line breaks, and key order stay the same, and lines that held only a comment are dropped. The pretty and minified options rebuild the layout without rounding numbers, so long IDs and large integers stay exact.

Frequently asked questions

Will it break URLs or text that contain //?

No. The remover reads the JSON the way a parser does, so anything inside a quoted string is left alone. A URL like "https://example.com" or a string containing /* stays exactly as written.

Is my JSON uploaded anywhere?

No. The comments are removed by JavaScript in your browser, so config files with API keys, tokens, or passwords never leave your device.

Can I remove comments from tsconfig.json?

Yes. Paste or open the file and the clean version appears right away. Trailing commas, which tsconfig files often have, are removed too. TypeScript itself reads comments fine, so you only need this when another tool has to read the file.

Does it validate the JSON?

Yes. After the comments are removed, the result is parsed as strict JSON. The badge shows Valid JSON or the first error, with its line and column. Click the error to jump to that spot in your input.

Can it convert JSON5 to JSON?

Yes. With Fix JSON5 syntax on, unquoted keys get quotes, single quotes become double quotes, and hex, plus-sign, and bare-decimal numbers become standard numbers. Infinity and NaN have no JSON equivalent, so they become null and the tool tells you where.

Will pretty-printing change my numbers?

No. Many formatters run the JSON through a parser, which rounds integers larger than 9,007,199,254,740,991. This one reformats the original text, so every number keeps its exact digits.

How do I remove comments from JSON in code?

In Node.js, the strip-json-comments package does it. In Python, the json5 or commentjson packages can read commented files. VS Code uses its own jsonc-parser package. For a one-off file, pasting it here is faster.

Our Full Dev Tool Library

Flipper File