How to count items in JSON object using command line?
Just throwing another solution in the mix...
Try jq
, a lightweight and flexible command-line JSON processor:
jq length /tmp/test.json
Prints the length of the array of objects.
The shortest expression is
curl 'http://…' | jq length