unjs/destr
🚀 Faster, secure and convenient alternative for JSON.parse for arbitrary inputs observed · 2026-08-28
Health v2 · maintenance only
79/100
- Activity 99
- 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-09-02. Adoption (stars, forks) is never an input.
- gap_med: 0
- age_days: 2296
- days_rel: 517
- days_push: 8
- n_releases_24m: 2
Adoption not part of the score
1376 stars · 32 forks observed · 2026-08-28
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-08-28 · 1532bba48dda
- registry_npm: https://registry.npmjs.org/destr · fetched 2026-08-29 · da144df9e2d8
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| unjs/destr | main | 79 |
For agents
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem