1.0.0 • Published 6 years ago

json-filter-cli v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Json Filter (CLI)

Simple console utility that takes JSON file and removes some properties from main object.

Installation

npm i -g json-filter-cli

Usage

For example, you have input.json:

{
  "a": 1,
  "b": 2,
  "c": 3
}

then, when you run

json-filter --from=input.json --to=output.json --only=a --only=b --space=2

you will get output.json that contains:

{
  "a": 1,
  "b": 2
}

Options

  • If no --from argument specified error will be returned.
  • If --only arguments present, all properties except specified as arguments will be removed.
  • If --except arguments present, all properties that specified as arguments will be removed.
  • If --to argument specified output will be saved in specified path. If no --to argument present input file will be overwritten.
  • --space - see third argument of JSON.stringify function.

Authors

License

MIT