json
/
2.0.0
json 2.0.0
Install from the command line:
Learn more about npm packages
$ npm install @supercharge/json@2.0.0
Install via package.json:
"@supercharge/json": "2.0.0"
About this version
Secure drop-in replacement for the global `JSON` object with prototype pollution protection
Follow @marcuspoehls and @superchargejs for updates!
The @supercharge/json
package is a drop-in replacement for the global JSON
object. It protects JSON parsing against protoype pollution attacks.
npm i @supercharge/json
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"}'
Do you miss a function? We very much appreciate your contribution! Please send in a pull request 😊
- Create a fork
- Create your feature branch:
git checkout -b my-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request 🚀
MIT © Supercharge
superchargejs.com · GitHub @supercharge · Twitter @superchargejs