Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Make jq options available #89

Open
mrandi opened this issue Aug 2, 2018 · 3 comments
Open

Make jq options available #89

mrandi opened this issue Aug 2, 2018 · 3 comments
Assignees

Comments

@mrandi
Copy link
Member

mrandi commented Aug 2, 2018

Make jq options available.

https://stedolan.github.io/jq/manual/
image

Expected Behaviour

Be able to apply options like -r
image

Current Behaviour

Currently is not possible to provide options.

Possible Solution

See: fiatjaf/jq-web#9

@fiatjaf
Copy link

fiatjaf commented Aug 2, 2018

We're accepting pull requests!

@raphaeleidus
Copy link
Contributor

@mrandi is this about getting these flags added to the generated shell command?
I don't feel these are useful in the actual UI inspection but could be useful to make available when the copy to shell is used.

@mrandi
Copy link
Member Author

mrandi commented Aug 3, 2018

@raphaeleidus I often have the need to filter and extract the data in csv, ending up using such a similar expression:
https://gist.githubusercontent.com/mrandi/5bd0f20e44b71e18086a989627ead943/raw/b1f9ce91f25ed19bacdecb292255a46ef432399e/json-test-file.json#broq-filter=.l1%20%7C%20map(select(.env%3D%3D%22prod%22))%20%7C%20map(%5B.name%2C%20.title%5D)%20%7C%20.%5B%5D%20%7C%20%40csv

image

The main problem is that I cannot directly use this result as I will need to remove the extra escaped quotes.

The same in curl:

curl https://gist.githubusercontent.com/mrandi/5bd0f20e44b71e18086a989627ead943/raw/b1f9ce91f25ed19bacdecb292255a46ef432399e/json-test-file.json | jq '.l1 | map(select(.env=="prod")) | map([.name, .title]) | .[] | @csv'

result:

"\"asdfasd\",\"one\""
"\"dfghobj\",\"two\""

With the -r option for example:

curl https://gist.githubusercontent.com/mrandi/5bd0f20e44b71e18086a989627ead943/raw/b1f9ce91f25ed19bacdecb292255a46ef432399e/json-test-file.json | jq -r '.l1 | map(select(.env=="prod")) | map([.name, .title]) | .[] | @csv'

result:

"asdfasd","one"
"dfghobj","two"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants