Tip of the Week – Making JSON readable on the command-line

Reading Time: 2 minutes

If you’re on Linux or Mac, the easiest way to make JSON data readable is by installing python on your machine and piping the following command behind the command that produces your JSON data:

python -m json.tool

Here is a quick example of the JSON we get when we call the JIRA REST API without the above command:

curl -X GET -H "Content-Type: application/json" https://jira.atlassian.com/rest/api/2/search?jql=key=JRA-45674

Here is the same request but now readable:

curl -X GET -H "Content-Type: application/json" https://jira.atlassian.com/rest/api/2/search?jql=key=JRA-45674 | python -m json.tool

Nice Layout JSON Data Screenshot

Quite an improvement if you ask me 🙂


If you’re on Windows you could do the following in Powershell to see all the fields of the issues our search returns:

Invoke-RestMethod -Method Get -Uri https://jira.atlassian.com/rest/api/2/search?jql=key=JRA-45674 | Select-Object -Property issues -ExpandProperty issues | Select-Object -Property fields -ExpandProperty fields

Powershell Results


If you want to start handling the JSON data right from the command line you can take a look at JQ, which is a lightweight and flexible command-line JSON processor and which will be the subject of another Tip of the Week.