Earlier quoted context omitted.
I like jq ( https://stedolan.github.io/jq/ ) for this purpose. It's a very flexible tool for filtering, querying and manipulating JSON data, but when run with no arguments, it performs a no-op transformation that just pretty-prints its input.
jq is yet another bloated syntax to learn and I'd definitely refrain from suggesting it to anyone whos not working with json everyday.
jq is something i've hated learning but powerful beyond tying grep and awk together.
jq is a tool, and like every tool, requires some upfront learning. Once mastered its much more productive than the grep/awk/friends solution.
Take this example JSON
{ "code": 42,
"items": [
{ "type":"color", "name":"red", "rgb": [120, 2, 2 ]},
{ "type":"color", "name":"green", "rgb": [2, 120, 2]}
]
}
for instance, to grab the rgb field for the color green... jq -r '.items | .[] | select(.name=="green") | .rgb