cURL Pretty JSON : In cURL requests, the default JSON output is in compact format.

// Terminal
curl https://api.cloudflare.com/client/v4/

{"success":false,"errors":[{"code":7000,"message":"No route for that URI"}],"messages":[],"result":null}

In cURL, we can use or pipe the json_pp to pretty print the JSON output.

// Terminal

curl https://api.cloudflare.com/client/v4/ | json_pp

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   104    0   104    0     0    400      0 --:--:-- --:--:-- --:--:--   398
{
   "errors" : [
      {
         "code" : 7000,
         "message" : "No route for that URI"
      }
   ],
   "success" : false,
   "result" : null,
   "messages" : []
}

References

Laisser un commentaire