Search code examples
curl

How to pretty json output from curl?


I am trying to do this:

curl localhost:3000/api/items/15/tools

This is the return right now:

{"recipe_tools":[{"id":19,"name":"Cutting Board","prices":{"display":"$49.99","value":"49.99"},"description":"Built to last,
... (and then like a million lines)

And it keeps going...

How do I pretty print or awesome print this? What can I do?


Solution

  • There are things you can install, but the simplest way is to use Python as it's typically already installed.

    curl localhost:3000/api/items/15/tools | python -m json.tool