Sometimes I need to quickly inspect a JSON file from the command line. The problem is that unlike viewing JSON data in most text editors or IDEs, the terminal provides no formatting or syntax highlighting to make things more readable.
I recently became aware of a great little tool named jq
. It describes itself as a “lightweight and flexible command-line JSON processor”. If you want to view JSON file and actually have it be readble, just run something like this:
cat foo.json| jq
Apparently it can do a lot more stuff, such as “slice and filter and map and transform structured data”, but I haven’t explored that yet. Enjoy!