[[email protected]]$ man jq

jq(1)                                       User Manuals                                       jq(1)

                                                                        Sun Oct  8 16:16:06 BST 2017

       jq   can   transform   JSON  in various ways, by selecting, iterating, reducing and otherwise
       mangling JSON documents.

       It reads a stream of JSON entities from stdin and coupled with other Unix command line  tools
       like curl, grep, awk, sed allows a quick manipulation of APIs.

       Let’s get JSON weather data from Open Weather Map API

       $ json=$(curl ‐s ’http://samples.openweathermap.org/data/2.5/forecast?id=524901&appid=1’)

       The returnet data is not human readable as the response is minified and returned in
       a single line

       $ echo $json | head ‐c 100

       This is where jq becomes handy. You can quickly format it using jq’s first argument which is a
       "filter". The dot is perhaps the simplest of all jq filters. It matches the current input.

       $ echo $json | jq . | head
         "cod": "200",
         "message": 0.0036,
         "cnt": 40,
         "list": [
             "dt": 1485799200,
             "main": {
               "temp": 261.45,
               "temp_min": 259.086,

Linux                                       October 2017                                       jq(1)

[[email protected]]$ ∎