The simplest way to install jq
and test that it works is through brew and then using the simplest filter that merely formats the JSON
brew
is the easiest way to manage packages on a mac:
brew install jq
Need brew
? Run the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Failing that: instructions to install and use are on https://brew.sh/
The .
filter takes its input and produces it unchanged as output. This is the identity operator. (quote the docs)
echo '{ "name":"John", "age":31, "city":"New York" }' | jq .
The result should appear like so in your terminal:
{
"name": "John",
"age": 31,
"city": "New York"
}