Package Exports
- jp-cli
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 (jp-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
jp
Simply parse JSON from any input source.
Inspired by jq; not a replacement. Supports Lodash .get() path syntax and JSONPath syntax. Also supports stdin streaming (see last example), i.e. line-by-line.
yarn global add jp-cli || npm install -g jp-cliUsage
Pipe jp onto a JSON source from the commandline to parse the output:
cat data.json | jp [options] query
Options:
-p, --path Use JSON Path notation (https://github.com/dchester/jsonpath)
-k, --keys Print object keys only [boolean]
-f, --file Read input from file [string]
-i, --indent Number of spaces for indentation (ignored by --human)
[number] [default: 2]
-h, --human Print human-readable (non-JSON) format [boolean]
-b, --break Set break length of object/array for human format [number]
-c, --no-color Disable color for human format [boolean]
-d, --depth Depth for human format [number]
-L, --line-by-line Parse each line as a separate input [boolean]
--help Show help [boolean]
Queries use the Lodash get method by default.
For more information, see https://github.com/therealklanni/jpExamples
$ cat user-response.json | jp data.user
{
"name": "Gazorpazorpfield"
"color": "orange"
}$ cat user-response.json | jp data.user | jp --keys
[
"name",
"color"
]$ cat user-response.json | jp data.user.name
"Gazorpazorpfield"jp can also parse JSON line-by-line from a stdin stream.
$ ipfs log tail | jp -L event | jq -r
updatePeer
handleFindPeerBegin
handleFindPeer
updatePeer
handleFindPeerBegin
handleFindPeer
Bitswap.Rebroadcast.active
Bitswap.Rebroadcast.idle
... until you ^CLicense
MIT © therealklanni