5

GitHub - niradler/json-cli-tool: Extract map and filter json output.

 3 years ago
source link: https://github.com/niradler/json-cli-tool
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

JSON CLI Tool

Extract map and filter json output. (lightweight jq alternative)

Installation

npm i -g json-cli-tool

Usage

jc help
{json} | jc --path="names" --filter="name=jay" --map="name"
{json} | jc --query=".names[]" // jmespath compatible
{json} | jc keys
{json} | jc values
echo '{"a":1,"b":2,"c":[1,2,3,4,5],"d":{"a":2,"b":3},"e":[{"a":1,"b":2,"c":[1,2,3,4,5],"d":{"a":2,"b":5}},{"a":2,"b":3,"c":[1,2,3,4,5],"d":{"a":2,"b":4}}]}' | jc --p="e" --m="a,b" --f="a=2"
# { a: 2, b: 3 }
curl --location --request GET 'http://www.7timer.info/bin/api.pl?lon=113.17&lat=23.09&product=astro&output=json' | jc --path 'dataseries' --map 'temp2m,prec_type' --filter 'temp2m=29'

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK