You can access the value  directly as if it were a javascript property: jq
-r .value - Check the online docs, there are tons of options for
mapping/fitlering/selecting/etc... This is probably thee best tool for
working with api's on the command line.

Also getting back to your actual question, use quotes: jq

On Tue, Dec 19, 2017 at 6:36 PM, James Shewey <[email protected]> wrote:

> Any idea how to make the output pipe-able? Eg:
>
> echo '{"value": "New", "onclick": "CreateNewDoc()"}' | jq
>
> works well and, as expected, I get:
>
> {
>   "value": "New",
>   "onclick": "CreateNewDoc()"
> }
>
> But I can't pipe that output to anything else and if I do:
>
> echo '{"value": "New", "onclick": "CreateNewDoc()"}' | jq | grep value
>
> this just errors out printing the tool usage guidelines.
>
> On Friday, December 8, 2017 at 2:00:11 PM UTC-7, Tom McKay wrote:
>>
>> @daviddavis reminded me of a nice utility I learned about recently:
>> jq[1]. I use it quite often in scripts involving container images where I
>> need the long sha256 to reference them.
>>
>> sudo skopeo inspect --raw docker-daemon:satellite.exampl
>> e.com:5000/examplecorp-docker_hub-alpine:3.4 | jq '.config | .digest'
>>
>> Enjoy!
>>
>> [1] https://stedolan.github.io/jq/tutorial/
>>
> --
> You received this message because you are subscribed to the Google Groups
> "foreman-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to