
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.
深遍历对象和数组,将所有JSON字符串转换成JS对象。
const object = {
a: 1,
b: '{"c": 2}',
d: {
e: "{"f": 3}",
},
};
parse(object);
// output:
const object = {
a: 1,
b: {
c: 2,
},
d: {
e: {
f: 3,
},
},
};
npm i all-parse -S
// ESM
import parse from 'all-parse';
const obj = parse(object);
const obj = parse(array);
// CommonJS
const parse = require('all-parse').default;
const obj = parse(object);
const obj = parse(array);
import JSON3 from 'json3';
import parse from 'all-parse';
const obj = parse(object, JSON3.parse);
方法存在副作用,会修改源对象,如果希望不影响源对象,可以再传入之前进行一次深拷贝:
import parse from 'all-parse';
const input = cloneDeep(object);
const obj = parse(input);
FAQs
Parse all properties of an object into a JS object from a JSON string.
The npm package all-parse receives a total of 0 weekly downloads. As such, all-parse popularity was classified as not popular.
We found that all-parse 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.