JP: JSON Processing Tool
JP combines both yajson-stream and RxJS to provide a powerful command line tool for filtering and transforming json streams.
Example
Take the following ndjson as an example:
{ "num": 1 }
{ "num": 1 }
{ "num": 1 }
Then select all num
and sum:
$ npm install -g json-processing
$ cat test.json | jp -l 'select(".num") |> reduce((a, b) => a + b, 0)' -m json
3
The -l
parameter defines the filtering and transformation sequence. It must start with a call to select(path: string)
, which takes a yajson-stream path as parameter. The return is an Observable from RxJS.
Bugs and Feedback
For bugs, questions and discussions please use the Github Issues.
LICENSE
Code and documentation released under The MIT License (MIT).