How to parse JSON after cURL

If you use cURL for requests to an API with JSON response in the body, you know that feeling of frustration at the sight of the wall of text in the console.

How to parse JSON after cURL
Response headers are included in the cURL output
Response headers are included in the cURL output
Invalid JSON is not parseable

Python

curl 'https://api.openweathermap.org/data/2.5/onecall?lat=40.1811&lon=44.5136&appid={api_key}' | python -m json.tool
| python -m json.tool
| python -m json.tool

jq

curl 'https://api.openweathermap.org/data/2.5/onecall?lat=40.1811&lon=44.5136&appid={api_key}' | jq
| jq
| jq
curl 'https://api.openweathermap.org/data/2.5/onecall?lat=40.1811&lon=44.5136&appid={api_key}' | jq .timezone
| jq .timezone
| jq .json_key

fx

fx navigation through JSON
fx navigation through JSON
curl 'https://api.openweathermap.org/data/2.5/onecall?lat=40.1811&lon=44.5136&appid={api_key}' | fx .
| fx .
| fx .
curl 'https://api.openweathermap.org/data/2.5/onecall?lat=40.1811&lon=44.5136&appid={api_key}' | fx .current.humidity
| fx .json_key

jless

curl 'https://api.openweathermap.org/data/2.5/onecall?lat=40.1811&lon=44.5136&appid={api_key}' | jless
| jless
| jless

--

--

Quality assurance engineer: I’m testing web applications, APIs and doing automation testing.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrey Enin

Quality assurance engineer: I’m testing web applications, APIs and doing automation testing.