
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
json-from-script
Advanced tools
A tiny (276B) JSON parser for your Content Security Policy aware script tags.
$ npm install --save json-from-script
When your HTML contains any script tag like this;
<script type="application/json" class="data" data-attr="foo">{"bar":"baz"}</script>
You can parse it in your Javascript application like this;
import jsonFromScript from 'json-from-script';
// Parsed will be { foo: { bar: 'baz' } }
const parsed = jsonFromScript();
jsonFromScript(selector, attribute)Creates a new instance of the parser with the given options. The following options can alternatively be provided to configure the parser for your specific needs:
selector <String>: The selector for the script tags to parse. (default: script.data)attribute <String>: The data attribute to use when setting the attribute on the parsed object. (default: data-attr)MIT © Robin van der Vleuten
FAQs
Tiny JSON parser for your CSP aware script tags
The npm package json-from-script receives a total of 41 weekly downloads. As such, json-from-script popularity was classified as not popular.
We found that json-from-script demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.