Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a `jq` command line tool or wrapper which lets you interactively explore `jq` similar to `jmespath.terminal`

jq is a lightweight and flexible command-line JSON processor.
https://stedolan.github.io/jq/

Is there a jq command line tool or wrapper which lets you pipe output into it and interactively explore jq, with the JSON input in one pane and your interactively updating result in another pane, similar to jmespath.terminal ?

I'm looking for something similar to the JMESPath Terminal jpterm
"JMESPath exploration tool in the terminal"
https://github.com/jmespath/jmespath.terminal

I found this project jqsh but it's not maintained and it appears to produce a lot of errors when I use it.
https://github.com/bmatsuo/jqsh

I've used https://jqplay.org/ and it's a great web based jq learning tool. However, I want to be able to, in the shell, pipe the json output of a command into an interactive jq which allows me to explore and experiment with jq commands.

Thanks in advance!

like image 522
caleban Avatar asked Jan 13 '17 09:01

caleban


2 Answers

I've been using jiq and I'm pretty happy with it.

https://github.com/fiatjaf/jiq

It's jid with jq.

You can drill down interactively by using jq filtering queries.

jiq uses jq internally, and it requires you to have jq in your PATH.

Using the aws cli

aws ec2 describe-regions --region-names us-east-1 us-west-1 | jiq

jiq output

[Filter]> .Regions
{
  "Regions": [
    {
      "Endpoint": "ec2.us-east-1.amazonaws.com",
      "RegionName": "us-east-1"
    },
    {
      "Endpoint": "ec2.us-west-1.amazonaws.com",
      "RegionName": "us-west-1"
    }
  ]
}
like image 109
caleban Avatar answered Sep 18 '22 16:09

caleban


https://github.com/simeji/jid

n.b. I'm not clear how strictly it follows jq syntax and feature set

like image 39
Yuri Schimke Avatar answered Sep 21 '22 16:09

Yuri Schimke