If you often deal with JSON-formatted texts from the command line or in shell scripts, you may wonder if there is any command-line utility which can parse JSON string. A command-line JSON parser can be handy when you test or debug JSON web services. You can feed JSON-formatted responses from web services into the command-line JSON parser, thereby easily inspecting otherwise hard-to-read JSON responses or extracting individual objects from them.

In this tutorial, I will describe how to parse JSON string from the command line.

On Linux, there is a command-line JSON processor called jq which does exactly that. Using jq, you can parse, filter, map, and transform JSON-structured data effortlessly.

To install jq on Linux, simply download its binary (available for 32-bit and 64-bit system separately) as follows.

Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.