Format JSON output using json_pp

Format curl output JSON

json_pp:

https://www.systutorials.com/docs/linux/man/1-json_pp/

https://stackoverflow.com/questions/27238411/display-curl-output-in-readable-json-format-in-unix-shell-script

Works like this:

curl http://localhost:8001/services | json_pp

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   386  100   386    0     0  25733      0 --:--:-- --:--:-- --:--:-- 25733
{
   "data" : [
      {
         "ca_certificates" : null,
         "client_certificate" : null,
         "connect_timeout" : 60000,
         "created_at" : 1632628311,
         "host" : "133.18.227.11",
         "id" : "dcdade9b-1eff-47b9-82a9-3c9d2af531de",
         "name" : "hello-service",
         "path" : null,
         "port" : 8080,
         "protocol" : "http",
         "read_timeout" : 60000,
         "retries" : 5,
         "tags" : null,
         "tls_verify" : null,
         "tls_verify_depth" : null,
         "updated_at" : 1632628311,
         "write_timeout" : 60000
      }
   ],
   "next" : null
}

Leave a Reply

Your email address will not be published. Required fields are marked *