A lot if not most web APIs return JSON. data is nowadays provided in JSON format. Rapid prototyping and ad-hoc scripting often necessitate dealing with such data on the command line. Doing so with classical tools like awk/sed/grep is very cumbersome because the data is hierarchical and not line-based. Many people will prefer to process JSON in Node JS, Python or other scripting languages and that is totally fine. Nonetheless, there are many use-cases where you may want to process JSON in the CLI or in small shell scripts. My preferred tool in these cases is jq. It has a powerful yet compact stream language to filter, aggregate, restructure, or, in general, arbitrarily process JSON and JSON streams (multiple newline-separated JSON objects). There are a few alternatives out there (here is a list) but jq seems to be the champion esp. for CLI. One other tool I have worked with a bit is JMESPath because it is integrated into the AWS CLI. JMESPath has the advantage of being standardized and being available as a library in multiple script languages. It is much less powerful than jq though and specifically less usable as a CLI tool. One reason is that jq has a raw mode and which combined with combinators can, for example, generate CSV directly.
Software: jq (https://stedolan.github.io/jq/)
Need: Process JSON on the command line
Alternatives: grep/sed/awk, trentm/json, JMESPath
A lot if not most web APIs return JSON. data is nowadays provided in JSON format. Rapid prototyping and ad-hoc scripting often necessitate dealing with such data on the command line. Doing so with classical tools like awk/sed/grep is very cumbersome because the data is hierarchical and not line-based. Many people will prefer to process JSON in Node JS, Python or other scripting languages and that is totally fine. Nonetheless, there are many use-cases where you may want to process JSON in the CLI or in small shell scripts. My preferred tool in these cases is jq. It has a powerful yet compact stream language to filter, aggregate, restructure, or, in general, arbitrarily process JSON and JSON streams (multiple newline-separated JSON objects). There are a few alternatives out there (here is a list) but jq seems to be the champion esp. for CLI. One other tool I have worked with a bit is JMESPath because it is integrated into the AWS CLI. JMESPath has the advantage of being standardized and being available as a library in multiple script languages. It is much less powerful than jq though and specifically less usable as a CLI tool. One reason is that jq has a raw mode and which combined with combinators can, for example, generate CSV directly.