# unjs/destr

🚀 Faster, secure and convenient alternative for JSON.parse for arbitrary inputs

Repository: https://github.com/unjs/destr
Canonical: https://ross.abutalabs.com/products/destr
Language: TypeScript
License: MIT
License Family: permissive
Topics: node, nodejs, deno, json, jsonparse
Last push: 2026-08-25T16:37:36+00:00

## Health v2 (maintenance only)
Score: 79/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 40, longevity 100
- inputs: {"age_days": 2296, "days_push": 8, "days_rel": 517, "gap_med": 0, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1376, forks 32 (observed 2026-08-28T04:04:33.253171+00:00)

## What it is
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
- artifact type: library
- maturity: stable
- function: serialization, parser, security
- domain: developer-tools, web-development, backend, apis
- platform: bun, cross-platform
- tags: -parse, prototype-pollution, typescript, untrusted-input, safe-parsing, nodejs, deno

## Member repositories
- unjs/destr (main) score 79

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:33.253171+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:40:32.612004+00:00, confidence not recorded.
  - readme: https://github.com/unjs/destr (fetched 2026-08-28T04:04:33.253171+00:00, sha 1532bba48dda)
  - registry_npm: https://registry.npmjs.org/destr (fetched 2026-08-29T11:57:01.771688+00:00, sha da144df9e2d8)
- Data as of 2026-08-30T08:39:29.467469+00:00.
