
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
get-json-val
Advanced tools
At the same time, it is a function to judge whether it is a JSON string and the result of parsing the JSON string.
Read this in other languages: English
同时判断是否是 JSON 字符串以及解析 JSON 字符串的结果的函数。
npm install get-json-val
或者
yarn install get-json-val
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| val | JSON 字符串 | string | - |
import { getJSONVal } from 'get-json-val'
getJSONVal(null as any)
// [new Error('value must be a string'), null]
getJSONVal('')
// [new Error('value must be a string'), null]
getJSONVal('a: 1')
// [new SyntaxError('Unexpected token a in JSON at position 0'), null]
getJSONVal('{"a":1}')
// [null, { a: 1 }]
FAQs
At the same time, it is a function to judge whether it is a JSON string and the result of parsing the JSON string.
We found that get-json-val demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.