@oresoftware/read.json

Semver-oriented TypeScript library skeleton.


Keywords
typescript, library, skeleton, scaffold, bash, json, modify-json, nodejs, read-json, shell
License
ICU
Install
npm install @oresoftware/read.json@0.0.111

Documentation


Version

@oresoftware/read.json

A simple alternative to jq for bash/shell Reads in JSON to stdin, and always writes JSON to stdout

installation

npm i -g @oresoftware/read.json

Usage

Given a foo.json file like so:

{
 "foo":{
   "bar": {
     "baz":"biz"
  }
 }
}

You can get 'biz' by running:

$ read_json -k 'foo.bar.baz' < foo.json

or equally like so:

$ read_json -k 'foo.bar.baz' -f  foo.json

To pass an expression to evaluate, use:

$ read_json --eval "['foo']['bar']['baz']" -f  foo.json

note that if you have keys with dots in them, it's necessary to use the --eval technique:

$ read_json --eval "['foo.x.y']" -f  foo.json

As a final example, if you run this:

$  cat foo.json | read_json

You will get this:

{"foo":{"bar":{"baz":"biz"}}}