Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
awesome-json2json
Advanced tools
An awesome json to jsone mapper
npm install awesome-json2json --save
import json2json from 'awesome-json2json';
// const json2json = require('awesome-json2json').default;
json2json({ foo: { bar: { baz: 1 }}}, {
new_foo: 'foo.bar.baz'
});
// { new_foo: 1 }
json2json({ foo: { bar: { baz: 1 }}}, {
new_foo: 'foo.not_exist_key?.bar.baz'
});
// { new_foo: undefined }
json2json({ foo: { bar: { baz: 1 }}}, {
new_foo: (root) => {
return root.foo.bar.baz + '_formatted';
}
});
// { new_foo: '1_formatted' }
json2json({ foo: { bar: { baz: 1 }}}, {
new_foo: {
$path: 'foo.bar',
$formatting: (bar) => {
return bar.baz + '_formatted';
}
}
});
// { new_foo: '1_formatted' }
json2json({ foo: { bar: { baz: 1 }}}, {
new_foo: {
$path: 'foo',
new_bar: 'bar.baz'
}
});
// { new_foo: { new_bar: 1 }}
json2json({ foo: { bar: { baz: 1 }}}, {
new_foo: {
$path: 'foo',
$formatting: (foo) => {
return {
baz2: foo.bar.baz + '_formatted'
}
},
new_bar: 'baz2'
}
});
// { new_foo: { new_bar: '1_formatted' }}
json2json({ foo: { bar: { baz: 1 }}}, {
new_foo: {
$path: 'foo',
new_bar: {
$path: 'bar',
new_baz1: 'baz',
new_baz2: '$root.foo'
}
}
});
// new_foo: {
// new_bar: {
// new_baz1: 1,
// new_baz2: {
// bar: {
// baz: 1
// }
// }
// }
// }
json2json({
foo: [
{ bar: 1 },
{ bar: 2 },
{ bar: 3 }
]
}, {
new_foo: 'foo[].bar'
});
// { new_foo: [1, 2, 3] }
json2json({
foo: [
{ bar: 1 },
{ bar: 2 },
{ bar: 3 }
]
}, {
new_foo: {
$path: 'foo[].bar',
$formatting: (barValue) => barValue + '_formatted'
}
});
// {
// new_foo: [
// '1_formatted',
// '2_formatted',
// '3_formatted'
// ]
// }
json2json({
foo: [
{ bar: 1 },
{ bar: 2 },
{ bar: 3 }
]
}, {
new_foo: {
$path: 'foo[]',
new_bar: {
$formatting: (fooItem) => {
return fooItem.bar;
}
}
}
});
// {
// new_foo: [
// { new_bar: 1 },
// { new_bar: 2 },
// { new_bar: 3 }
// ]
// }
FAQs
An awesome json to json mapper
We found that awesome-json2json 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.