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

tsakistan picture tsakistan  路  30Comments

ghost picture ghost  路  69Comments

ilyash picture ilyash  路  22Comments

lylemoffitt picture lylemoffitt  路  44Comments

vito-c picture vito-c  路  33Comments