
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
serialize-js
Advanced tools
Small serialization helper for those who wants to get JS representation of object but gets only this dirty JSON.
Sometimes it's useful to serialize object into the JS user-readable representation but the only option you have is JSON which adds all this damn quotes around any keys (incl. valid identifiers), indents entire contents of any objects/arrays etc.
This small serializer allows you to overcome that and get pretty representations, just as you would write it with own hands in code:
| obj | JSON.stringify(obj, null, 2) | serialize(obj) |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
You can optionally pass options object as second argument (serialize(obj, { /*...options...*/ })).
Possible options are below:
Type: String
Default: ''
Initial indentation of output (generated indentation will be relative to this one).
Type: Number|String
Default: 2
Indentation to be used for nested representations; it can be either number of spaces or explicit string (like '\t').
Type: Boolean
Default: false
If set to true, generates JSON-compatible output (all the keys are wrapped with quotes, but indentation is still optimized).
FAQs
User-readable object serialization for JavaScript.
We found that serialize-js 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

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.