Jq: How to escape '.' ?

Created on 25 Oct 2013  路  5Comments  路  Source: stedolan/jq

Hello,

Could please tell me how to escape '.'?

I already tried a few different approaches, but they all failed

examples:

./jq '.global".proxy.process.dns.in_flight"'

./jq '.global.proxy$process$dns$in_flight'

./jq '.global.proxy.process.dns.in_flight'

Thanks in advance

support

Most helpful comment

No . before the []. So cat stats | ./jq '.global["proxy.process.dns.inflight"]' - just like in JavaScript.

All 5 comments

See issue #42 ?

Thank you,

But I failed to get it working

I have an element global and in global i got 'proxy.process.dns.in_flight'

I tried

cat _stats | ./jq '.global.["proxy.process.dns.in_flight"]'
error: syntax error, unexpected '[', expecting IDENT
.global.["proxy.process.dns.in_flight"]
^
1 compile error

I don't understand my mistake.

Thanks in advance!

No . before the []. So cat stats | ./jq '.global["proxy.process.dns.inflight"]' - just like in JavaScript.

Thank you lluchs. This fixed my problem.

Thanks iluchs for the solution. It worked

Was this page helpful?
0 / 5 - 0 ratings