formatting or parse json in command line

To easily format json or command line there jq

example

$ echo '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' | jq .
{
    "user": "stedolan",
      "titles": [
          "JQ Primer",
              "More JQ"
                ]
}

or just print specific value

$ echo '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}' | jq .titles[0]
"JQ Primer"

Last updated