Jq: Extract a field's value based on another field

Created on 31 Mar 2018  路  2Comments  路  Source: stedolan/jq

Hello,

I would like to a field's value based on another field's value. I tried this:
jq '.[] | select(.[logged_in_link] | contains ("virtual") | .id' )
but it gives me error: jq: error: syntax error, unexpected $end, expecting ';' or ')' (Unix shell quoting issues?) at , line 1:
.[] | select(.[logged_in_link] | contains ("virtual") | .id
How can I get the value? Thanks a lot

Most helpful comment

You probably meant something like this:

jq '.[] | select(.["logged_in_link"] | contains ("virtual")) | .id'

(Usually the error message is worth heeding.)

In future, please ask usage questions such as this at stackoverflow.com https://stackoverflow.com/questions/tagged/jq

Thank you.

All 2 comments

You probably meant something like this:

jq '.[] | select(.["logged_in_link"] | contains ("virtual")) | .id'

(Usually the error message is worth heeding.)

In future, please ask usage questions such as this at stackoverflow.com https://stackoverflow.com/questions/tagged/jq

Thank you.

It works like a charm!
Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sloanlance picture sloanlance  路  3Comments

tbelaire picture tbelaire  路  4Comments

geoffeg picture geoffeg  路  3Comments

neowulf picture neowulf  路  3Comments

kaihendry picture kaihendry  路  4Comments