parse-json is a JavaScript utility for parsing JSON while producing more helpful error messages than the built-in JSON.parse, including line and column details and a code frame. It throws a JSONError that supports instanceof checks and can include an optional filename to improve the displayed error context.
Project status
- The project is likely no longer actively maintained, with the most recent upstream push and package update on 2025-04-09, about 17 months ago relative to 2026-09-10.
- Update cadence appears sporadic, with a short burst in early 2025 (v8.2.0 on 2025-03-21, v8.3.0 on 2025-04-09) followed by a long gap with no further updates shown.
AI summary generated
Recent updates
v8.3.0
Release v8.3.0 primarily updates dependencies. However, the code diff shows a behavioral change in error location calculation inside index.js, which is not mentioned in the release notes.
v8.2.0
v8.2.0 improves JSON parse errors by attaching the original thrown SyntaxError from JSON.parse to JSONError.cause. The implementation also refactors JSONError to lazily generate its message and code frames, and updates documentation examples accordingly.
Featuresv8.1.0
v8.1.0 primarily removes the runtime dependency on `json-parse-even-better-errors`. The diff shows that this is not a pure dependency cleanup, the library now generates and rewrites JSON parse error messages itself, which changes the resulting error strings and how location/code frames are derived.
v8.0.1
v8.0.1 is a small patch release intended to improve the error code frame produced when parsing invalid JSON, specifically around parsing `{`. The diff also includes a refactor of JSONError message handling and an adjustment to how error locations are computed when the reported index is out of bounds.
v8.0.0
v8.0.0 primarily raises the minimum supported Node.js version to 18. The release notes mention only that breaking requirement, but the actual code changes include a rewritten JSONError implementation and updated error-positioning logic plus dependency swaps.
Breakingv7.1.1
v7.1.1 updates parse-json to fix the reported code frame formatting for Node.js v21 by adjusting how the parser extracts the error location from Node's JSON.parse error message. The change also updates CI to include Node 20 and 21 and refines the test expectations around Node-specific error message formats.
v7.1.0
v7.1.0 adds a new `rawCodeFrame` string property to the `JSONError` thrown by `parse-json`. It also updates TypeScript types and tests to reflect the new property and includes documentation for it.
Featuresv7.0.0
v7.0.0 raises the minimum Node.js requirement to Node 16 and introduces TypeScript typings (including a JSONError type). The release notes are minimal, but the actual diff also shows dependency major-version bumps and documentation changes around how JSONError is referenced.
BreakingFeaturesv6.0.2
v6.0.2 updates how parse-json depends on `lines-and-columns`. The release notes only mention fixing the dependency, and do not describe any behavioral impact from the underlying major dependency change.
v6.0.1
v6.0.1 is a small compatibility-only release that targets Webpack issues. The documented change is specifically a Webpack compatibility fix, and the code diff shows it by altering how the `lines-and-columns` dependency is loaded.