Back to Blog

In this post, we will beautify the output of the cURL using jq. In this way, we can get more readable responses from the cURL and test our APIs easily.

Firstly, let’s make a simple API request to the Finage’s currency API using cURL. 

curl  ",EURUSD&apikey=YOUR_API_KEY"

This command will return an output given below.

As you can see, it’s hard to read. It’s a basic API call. Finage has more than 700+ symbols. This response could be more complicated. Let’s beautify it with jq.

Install jq

Install jq for MacOS

brew install jq

Install jq for Linux

sudo apt-get install jq

You can check jq’s page for more installation instructions for other platforms.

Beautify & Parse with jq

Now, let’s change the request that we made using jq;

curl  ",EURUSD&apikey=YOUR_API_KEY" | jq '.'

This will return a response like this,

It’s more readable and easy to parse now. You can pick any property of the JSON response object like;

curl  ",EURUSD&apikey=YOUR_API_KEY" | jq '.lastUpdate'

It will return 


Also, we can get only the property names or values from the response. Check the command below,

curl  ",EURUSD&apikey=YOUR_API_KEY" | jq '.currencies[].name'

With jq, you can test your APIs easily and make it readable. For more information about the jq, please visit the jq Manual.

You can check all available symbols in the Finage’s documentation. 

US Stock API Symbol List