Strip-json-comments removes JavaScript-style comments from JSON text, turning commented JSON into something you can parse (for example, preserving error positions by replacing comments with whitespace). It also has options like removing trailing commas and choosing whether to replace comments with whitespace or strip them out.
Project status
- Actively maintained, with a recent upstream push on 2025-08-08 and follow-up updates still landing in 2025.
- Update cadence appears bursty rather than continuous: two updates within about 3 months in 2025 (v5.0.2 on 2025-05-16, v5.0.3 on 2025-08-08), and the previous update before that was much earlier (v5.0.1 on 2023-07-04).
AI summary generated Today
Recent updates
v5.0.3
9 months agov5.0.3 primarily fixes how strip-json-comments handles malformed block comments at the end of the input. The release notes mention only this behavioral correction.
v5.0.2
5/16/2025v5.0.2 is a small patch release focused on fixing JSON validity when stripping comments while preserving whitespace. It adjusts how whitespace is normalized in the whitespace-preserving path and adds a regression test for non-breaking space characters inside comments.
v5.0.1
7/4/2023v5.0.1 is a small patch release that primarily updates the TypeScript type definitions for strip-json-comments. The release notes mention a TypeScript doc comment fix, and the diff shows changes limited to the public typings, package metadata/dev tooling, and README content.
v5.0.0
7/22/2022strip-json-comments v5.0.0 introduces support for stripping trailing commas (behind a new option). It also raises the minimum Node.js requirement. The release notes only mention these high-level changes, but the diff shows additional tightening of the Node engine range and some related behavioral documentation updates.
BreakingFeaturesv4.0.0
8/19/2021v4.0.0 is a major release that converts strip-json-comments to a pure ESM package and updates the supported Node.js versions. The code changes also include TypeScript definition shape changes and packaging metadata updates beyond what the release notes explicitly call out.
Breakingv3.1.1
7/12/2020v3.1.1 primarily updates package metadata and documentation. The release notes only mention adding the jsonc keyword, but the diff also includes CI configuration and README/metadata tweaks.
v3.1.0
4/6/2020v3.1.0 adds strict runtime type validation for the main strip-json-comments entry point. If `jsonString` is not a string, the module now throws a `TypeError` instead of proceeding.
Breakingv3.0.1
4/30/2019v3.0.1 updates strip-json-comments to correctly handle a previously failing edge case involving weird escaping sequences inside JSON strings (referenced as #41). The code change improves how the parser determines whether a quote is escaped by counting consecutive backslashes.
v3.0.0
4/30/2019v3.0.0 of strip-json-comments adds TypeScript type definitions and raises the minimum supported Node.js version. The core implementation was refactored and introduces subtle behavioral changes around comment handling and options processing that are not mentioned in the release notes.
BreakingFeaturesv2.0.0
11/18/2015This release changes how strip-json-comments handles comments, replacing them with whitespace by default to preserve character positions for better error location mapping. It also reorganizes the project by dropping legacy distribution support for Bower/Component and moving the CLI into a separate module.
Breaking