JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 23360
  • Score
    100M100P100Q128216F
  • License MIT

Easily edit a json file from the CLI or NodeJS

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 --save

Use from the CLI

dot-json myfile.json user.name
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:
  -d --delete     Delete the key-path
  -h --help       Show this message with options
  -v --version    Print the version number

Use 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');

npmjs.org/package/dot-json