escape-html-in-json
1.0.0 • Public • Published escape-html-in-json
Escape HTML entities in JSON.stringify
, using a replacer method.
> var escape_html_entities = require('escape-html-in-json')
> var object = {name: "<script>alert('hacked');</script>"}
> JSON.stringify(object)
'{"name":"<script>alert(\'hacked\');</script>"}'
> JSON.stringify(object, escape_html_entities)
'{"name":"<script>alert('hacked');</script>"}'
Versions
Current Tags
- VersionDownloads (Last 7 Days)
- 1.0.0
200
Version History
- VersionDownloads (Last 7 Days)
- 1.0.0
200
Package Sidebar
Install
npm i escape-html-in-json
Weekly Downloads