
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.
json-mapping
Advanced tools
Transform a JSON object structure.
npm install json-mapping
const mapping = require('json-mapping');
let json = {
"appURL": "localhost",
"object1": {
"bool": true,
"name": "app"
}
};
json = mapping.map(json, [
{
oldKey: "appURL",
newKey: "url"
},
{
oldKey: "object1.bool",
newKey: "object1.enabled"
}
]);
/*
{
"url": "localhost",
"object1": {
"enabled": true,
"name": "app"
}
}
*/
| Name | Type | Description |
|---|---|---|
| json | object | The initial JSON object to be mapped |
| mapping* | array | An array containing the mapping options |
| Name | Type | Description |
|---|---|---|
| oldKey | string | The old property name to be mapped |
| newKey | string | The new property name to be mapped |
| values** | array | An array of mapped values for this property mapping |
| dependsOn** | object | Determines the value for the newKey based on a condition |
| Name | Type | Description |
|---|---|---|
| oldValue | any | The old value of the property to be mapped |
| newValue | any | The new value of the property to be mapped |
| Name | Type | Description |
|---|---|---|
| key | string | The key to look for |
| if | any | The value to evaluate for the key |
| ifValue | any | When key === if, this will be the value of the newKey |
| elseValue | any | When key !== if, this will be the value of the newKey |
| Name | Type | Return | Description |
|---|---|---|---|
| map | function | object | Maps a JSON object using mapping options |
MIT © Vincent Morneau
FAQs
Small module to map a JSON structure to a new structure
We found that json-mapping 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.