{"repo":"unjs/destr","free":true,"listed":false,"github":"https://github.com/unjs/destr","clone":"git clone https://github.com/unjs/destr.git","description":"🚀 Faster, secure and convenient alternative for JSON.parse for arbitrary inputs","language":"TypeScript","stars":1376,"topics":["node","nodejs","deno","json","jsonparse"],"license":"MIT","category":"dev-tools","readme_excerpt":"destr [![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![bundle][bundle-src]][bundle-href] [![License][license-src]][license-href] A faster, secure and convenient alternative for JSON.parse . Usage Node.js Install dependency: Import into your Node.js project: Deno Why? ✅ Type Safe ✅ Fast fallback to input if is not string ✅ Fast lookup for known string values ✅ Fallback to original value if parse fails (empty or any plain string) Note: This fails in safe/strict mode with safeDestr . ✅ Avoid prototype pollution ✅ Strict Mode When using safeDestr it will throw an error if the input is not a valid JSON string or parsing fails. (non string values and built-ins will be still returned as-is) Benchmarks destr is faster generally for arbitrary inputs but also sometimes little bit slower than JSON.parse when parsing a valid JSON string mainly because of transform to avoid prototype pollution which can lead to serious security issues if not being sanitized. In the other words, destr is better when input is not always a JSON string or from untrusted source like request body. Check Benchmark Results or run with pnpm run bench:node or pnpm run bench:bun yourself! License MIT. Made with 💖 [npm-version-src]: https://img.shields.io/npm/v/destr?style=flat&colorA=18181B&colorB=F0DB4F [npm-version-href]: https://npmjs.com/package/destr [npm-downloads-src]: https://img.shields.io/npm/dm/destr?style=flat&colorA=18181B&colorB=F0DB4F [n","default_branch":null,"files":null,"tree":[],"storefront":"/r/unjs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/unjs/destr/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}