Package Exports
- dot-json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dot-json) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
dot-json
Easily edit a json file from the CLI or NodeJS.
Install via NodeJS
npm install dot-json --saveUse from the CLI
dot-json myfile.json user.nameUsage:
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:
-d --delete Delete the key-path
-h --help Show this message with options
-v --version Print the version numberUse it in NodeJS
var dot_json = require('dot_json');
var file = dot_json.file('myfile.json')
file.set('user.name', 'john');
file.set('user.email', 'john@example.com');
var value = dot_json.file('myfile.json').get('user.name');
console.log(value);
file.delete('user.name');