Resolving properties which would change value with
JSON.stringify()
This never throws.
Options
Object with the following properties.
maxSize
Type: number Default: 1e7
Big JSON strings can make a process, filesystem operation or network request
crash. maxSize prevents it by setting a maximum
JSON.stringify(value).length.
Additional properties beyond the size limit are omitted. They are
completely removed, not truncated (including strings).
If false, object/array properties are processed recursively. Please note that
cycles are not removed when this is true.
Return value
Object with the following properties.
value
Type: any
Copy of the input value after applying all the changes to make
it JSON-safe.
The top-level value itself might be changed (including to undefined) if it
is either invalid JSON or has a toJSON() method.
The value is not serialized to a JSON string. This allows choosing the
serialization format (JSON, YAML, etc.), processing the value, etc.
changes
Type: Change[]
List of changes applied to value. Each item is an
individual change to a specific property. A given property might have multiple
changes, listed in order.
changes[*].path
Type: Array<string | symbol | number>
Property path.
changes[*].oldValue
Type: any
Property value before the change.
changes[*].newValue
Type: any
Property value after the change. undefined means the property was omitted.
The npm package safe-json-value receives a total of 3,213 weekly downloads. As such, safe-json-value popularity was classified as popular.
We found that safe-json-value demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Package last updated on 29 Mar 2025
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
By Lauren Valencia, Kirill Boychenko - Sep 17, 2025
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.
By Kush Pandya, Peter van der Zee, Olivia Brown - Sep 16, 2025