Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Easily edit a json file from the CLI or NodeJS.
npm install -g dot-json
or local
npm install dot-json
dot-json myfile.json user.name "John Doe"
dot-json myfile.json user.email "john@example.com"
dot-json myfile.json foo..bar baz
dot-json myfile.json address '{"city":"Atlantis"}' --json-value
myfile.json now looks like
{
"user": {
"name": "John Doe",
"email": "john@example.com"
},
"foo.bar": "baz",
"address": {
"city": "Atlantis"
}
}
dot-json myfile.json user.name
John Doe
Usage:
dot-json <file> <key-path> Get a value from a json file by key-path
dot-json <file> <key-path> <value> Assign a value at a key-path
dot-json <file> <key-path> --delete Delete a key by key-path
Options:
--indent=<n> Indent with <n> of white space characters [default: auto] [--json-value]
-d --delete Delete the key-path
-j --json-value Parse the input value as a JSON string (to set whole objects or arrays)
-h --help Show this message with options
-v --version Print the version number
Add to .bash_profile:
alias package="dot-json package.json"
Use it like this:
package name "my-package"
var DotJson = require('dot-json');
var myfile = new DotJson('myfile.json');
asynchronous
myfile.set('user.name', 'John Doe').set('user.email', 'john@example.com').save(function(){
console.log('saved');
});
synchronous
myfile.set('user.name', 'John Doe').set('user.email', 'john@example.com').save();
myfile.json now looks like
{
"user": {
"name": "John Doe",
"email": "john@example.com"
}
}
asynchronous
myfile.get('user.name', function(value){
// value = 'John Doe'
console.log(value);
});
synchronous
var value = myfile.get('user.name');
// value = 'John Doe'
console.log(value);
asynchronous
myfile.delete('user.name').save(function(){
console.log('saved');
});
synchronous
myfile.delete('user.name').save();
myfile.json now looks like
{
"user": {
"email": "john@example.com"
}
}
FAQs
Easily edit a json file from the CLI or NodeJS
We found that dot-json 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.