unjs/destr
Some data may be outdated — see provenance labels.
🚀 Faster, secure and convenient alternative for JSON.parse for arbitrary inputs observed · 2026-10-02
Health v2 · maintenance only
78/100
- Activity 97
- Release rhythm 40
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-10-21. Adoption (stars, forks) is never an input.
- gap_med: 0
- age_days: 2344
- days_rel: 565
- days_push: 19
- n_releases_24m: 2
Adoption not part of the score
1380 stars · 31 forks observed · 2026-10-02
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
destr is a TypeScript library providing a faster, safer alternative to JSON.parse for arbitrary inputs. It gracefully falls back to the original value on parse failure, handles non-string inputs, and sanitizes __proto__ keys to prevent prototype pollution.
Use cases
- safely parse untrusted JSON from request bodies
- parse config values that may or may not be JSON strings
- avoid crashes from JSON.parse on undefined or plain strings
- prevent prototype pollution attacks when parsing JSON
- get typed JSON parsing results in TypeScript
- strictly validate JSON strings with safeDestr
When to choose
- input is arbitrary or from untrusted sources like HTTP request bodies
- you want graceful fallback instead of SyntaxError on invalid input
- you need protection against prototype pollution in parsed JSON
- you want a tiny, fast drop-in replacement for JSON.parse
When to avoid
- you only parse known-valid, trusted JSON where raw JSON.parse performance matters most
- you need full JSON5 or comment-tolerant parsing
- you need strict schema validation of parsed structures
Facets
library · maturity stable
serialization parser security developer-tools web-development backend apis bun cross-platform -parse prototype-pollution typescript untrusted-input safe-parsing nodejs deno
2 sources
- readme: https://github.com/unjs/destr · fetched 2026-10-02 · 1532bba48dda
- registry_npm: https://registry.npmjs.org/destr · fetched 2026-08-29 · da144df9e2d8
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| unjs/destr | main | 78 |
For agents
Data as of 2026-10-19T08:05:51.212177+00:00 · Report a problem