TIL: How to use the jq command to filter json data
Testing jq
I found the following examples useful.
Print output in one single line:
<something> | jq '.data[0].accounts[]' | jq -j '.currency,"$ ", .balance, "\n"'
Print json in one single line:
<something> | jq '.data[0].accounts[]' | jq -c '{"balance": .balance, "currency": .currency}'
Create json objects:
<something> | jq '.data[]' | jq '{"id": .id, "first name": .first_name, "policy": .compliance_policy, "type": .type}'