@supercharge/json
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published


JSON

Secure drop-in replacement for the global `JSON` object with prototype pollution protection


Installation · Usage



Latest Version Monthly downloads

Follow @marcuspoehls and @superchargejs for updates!


Introduction

The @supercharge/json package is a drop-in replacement for the global JSON object. It protects JSON parsing against protoype pollution attacks.

Installation

npm i @supercharge/json

Usage

Using @supercharge/json is pretty straightforward. Use it the same way as you would use the JSON object:

const JSON = require('@supercharge/json')

const user = JSON.parse('{"name":"Supercharge"}')
// { name: 'Supercharge' }

const user = JSON.parse('{"name":"Supercharge", "__proto__": { "x": 1 }, "constructor": {"prototype": {"bar": "baz"} } }')
// { name: 'Supercharge' }


const json = JSON.stringify({ name: 'Supercharge' })
// '{"name":"Supercharge"}'

Contributing

Do you miss a function? We very much appreciate your contribution! Please send in a pull request 😊

  1. Create a fork
  2. Create your feature branch: git checkout -b my-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request 🚀

License

MIT © Supercharge


superchargejs.com  ·  GitHub @supercharge  ·  Twitter @superchargejs

Package Sidebar

Install

npm i @supercharge/json

Weekly Downloads

164

Version

2.0.0

License

MIT

Unpacked Size

9.64 kB

Total Files

9

Last publish

Collaborators

  • marcuspoehls
  • peitek
  • celsiusf