How can I pipe jq output

HOW TO -️ October 18, 2021

I recently learned about an outstanding little tool, jq that allows you to pipe unformatted JSON output into it and then have that output reformatted and output to the screen in a very nicely formatted color-coded json layout. Eg:

ERROR Rendering Code Block

I have found however, that I am unable to pipe the formatted results (from jq) into additional tools in my standard toolset, such as grep, sed, awk, etc. How can I make make this output pipe-able? Eg, this doesn't work:

ERROR Rendering Code Block

Answer

This seems to be a usage question on a general-purpose command-line tool. It seems more appropriate for Super User or Linux & Unix? @XiongChiamiov - I posted here because DevOps seems significantly more likely to interact with JSON/REST and would benefit from 1) knowing about such a tool and 2) it's proper usage. I would categorize this as a *DevOps* command line tool, not general purpose. My devs are far more familiar with these sorts of tools than I am, because they're *building APIs* and thus testing them constantly throughout the day. While that will of course vary from company to company, I still think that curl/httpie/jq/etc. are just general-purpose programmer-y tools, not DevOps-related tools at all.

Initializing...