
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.
properJSONify
Advanced tools
Goes through a javascript object (recursively) and transforms every key into it's camelCase version (also takes a custom key transformation function), and sorts keys alphabetically (also takes a custom compare function).
More often than not you'll have to work with a service that outputs { "ThingsLike": "this" }
or { "things_like": "this" } or even god forbid { "things.like": "this" }. When that happens,
use properJSONify.
yarn add properJSONify
properJSONify(obj: object | array, customKeyTransform: function, customSortCompare: function)
const properJSONify = require('properJSONify');
const obj = {
WordsAndWords: 1,
nested_object: {
'weird.key': 2,
},
};
properJSONify(obj);
/*
Output
{
wordsAndWords: 1,
nestedObject: {
weirdKey: 2,
},
}
*/
If camelCase is not what you're after then just pass a transformation function as the
second argument to properJSONify. For instance if you want to prefix all keys with
_, you would do:
properJSONify({ a: 1 }, key => `_${key}`);
/*
Output:
{ _a: 1 }
*/
By default properJSONify will sort object keys alphabetically,
but you can also use a custom sort function that will be passed to the normal array sort method:
properJSONify({ z: 1, y: 2 }, null, (a, b) => 1);
/*
Output:
{ y: 2, z: 1 }
*/
_ in case of an existing duplicate;FAQs
Camelcaseify object keys
We found that properJSONify 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.