Jq: Function to strip quotes from a string

Created on 23 Apr 2013  路  6Comments  路  Source: stedolan/jq

When getting output from json apis and attempting to use them with other unix utilities, you often need just the value of a string without the surrounding quotes. Clearly i can do something like:

curl ... | jq .keypairs[$i].keypair.name | tr -d '"'

but it would be nice to be able to do:

curl ... | jq '.keypairs[$i].keypair.name | tovalue'

or something along those lines

support

Most helpful comment

All 6 comments

alternatively it could be a comand line switch to print strings without quotes:

curl ... | jq -z .keypairs[$i].keypair.name

ah thanks didn't see that one

Great, thanks ghost

Thanks @ghost !

awesome this helped me too thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mcandre picture mcandre  路  3Comments

sloanlance picture sloanlance  路  3Comments

lhunath picture lhunath  路  3Comments

kelchy picture kelchy  路  4Comments

rokka-n picture rokka-n  路  4Comments