unstale

npm / safe-stable-stringify

safe-stable-stringify

What changed in safe-stable-stringify 2 to 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

5 breaking5 new APIs and options2 performance7 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

safe-stable-stringify 312 changes

Breaking changes 2

  • The default circular marker is now '[Circular: N]', where N is the referenced ancestor's depth; set circularValue to '[Circular]' to retain the previous format.

    3.0.0release notes

  • Node.js 18 or later is required; older versions may still work but are not supported.

    3.0.0release notes

New APIs and options 2

  • The bigint option accepts 'string', serializing bigint values as JSON strings.

    3.0.0release notes

  • The safe option prevents failures when a getter, .toJSON(), or replacer throws, replacing the object inspection with a string error message; it defaults to false.

    3.0.0release notes

Performance 1

  • Sorting and escaping are faster on newer Node.js versions.

    3.0.0release notes

Fixes and other changes 7

  • BigInt typed-array entries now honor bigint: false and strict mode.

    3.0.1release notes

  • Caught error messages are escaped in safe mode so quotes, backslashes, and control characters produce valid JSON.

    3.0.1release notes

  • When safe is enabled, strict-mode errors are reported at their typed-array indices.

    3.0.1release notes

  • ESM imports work in Node.js and bundlers, including applications that also use CommonJS.

    3.0.0release notes

  • Fixed an off-by-one error that caused one fewer entry than intended to be skipped.

    3.0.0release notes

  • Using a negative spacer number no longer throws.

    3.0.0release notes

  • Non-finite floating-point typed array values, such as Infinity in a Float32Array, are now serialized correctly.

    3.0.0release notes

safe-stable-stringify 27 changes

Breaking changes 3

  • BigInt values are converted to numbers by default; set the bigint option to false to ignore them as in earlier versions.

    2.0.0release notes

  • The package requires ES6.

    2.0.0release notes

  • Stateful indentation was removed to guarantee side-effect freeness.

    2.0.0release notes

New APIs and options 3

Performance 1

  • TypedArray stringification is significantly faster.

    2.0.0release notes