# @luxass/strip-json-comments

> strip comments from your json

Latest version **2.0.2** (published 2026-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @luxass/strip-json-comments
pnpm add @luxass/strip-json-comments
yarn add @luxass/strip-json-comments
bun add @luxass/strip-json-comments
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2026-09-17 |
| First published | 2023-10-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=24 |
| Dependencies | 0 |
| Unpacked size | 13.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1 |
| Author | Lucas Nørgård |
| Maintainers | luxass |
| Keywords | comments, config, configuration, delete, env, environment, json, jsonc, multiline, parse, remove, settings, strip, trim, util |

## Links

- npm: https://www.npmjs.com/package/@luxass/strip-json-comments
- Repository: https://github.com/luxass/strip-json-comments
- Issues: https://github.com/luxass/strip-json-comments/issues
- npm.io page: https://npm.io/package/@luxass/strip-json-comments

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.2 (latest) — 2026-09-17
- 2.0.1 — 2026-02-13
- 2.0.0 — 2025-10-29
- 1.4.0 — 2025-01-12
- 1.3.2 — 2024-06-30
- 1.3.1 — 2024-06-30
- 1.3.0 — 2024-06-30
- 1.2.0 — 2024-01-19
- 1.1.1 — 2023-12-03
- 1.1.0 — 2023-11-19
- 1.0.0 — 2023-10-21

## README

# strip-json-comments

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]

A fork of [sindresorhus/strip-json-comments](https://github.com/sindresorhus/strip-json-comments) but with support for CJS & ESM. And some small modifications.

## 📦 Installation

```sh
npm install @luxass/strip-json-comments
```

## 📚 Usage

There is a small difference to the original package. You can see it [here](#differences-to-sindresorhusstrip-json-comments).

```ts
import { strip } from "@luxass/strip-json-comments";

const json = `{
  // this is a comment
  "foo": /* this is also a comment */ "bar"
}`;

JSON.parse(strip(json)); // { foo: "bar" }
```

## Differences to [sindresorhus/strip-json-comments](https://github.com/sindresorhus/strip-json-comments)

The main differences are:

- This package is published as ESM & CJS
- And the `default export` is moved to a `named export` called `strip`

```diff
- import stripJsonComments from "strip-json-comments";
+ import { strip } from "@luxass/strip-json-comments";
```

## 📄 License

Published under [MIT License](./LICENSE).

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/@luxass/strip-json-comments?style=flat&colorA=18181B&colorB=4169E1
[npm-version-href]: https://npmjs.com/package/@luxass/strip-json-comments
[npm-downloads-src]: https://img.shields.io/npm/dm/@luxass/strip-json-comments?style=flat&colorA=18181B&colorB=4169E1
[npm-downloads-href]: https://npmjs.com/package/@luxass/strip-json-comments

---
_Source: https://npm.io/package/@luxass/strip-json-comments · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
