3 ms·
jq is awesome. While it can do a lot of really cool processing to filter out nested details, the majority of my usage of it is: $PROGRAM_THAT_OUTPUTS_JSON
by koolba 10y ago
jq is awesome. While it can do a lot of really cool processing to filter out nested details, the majority of my usage of it is:
$PROGRAM_THAT_OUTPUTS_JSON | jq .
Which simply pretty prints the JSON input with two spaces per indentation. Also, $PROGRAM_THAT_OUTPUTS_JSON is usually a script that simply outputs the clipboard (alias for "xclip -o").
- grayrest 10y agoMy usage is generally pretty simple as well but if people are looking for a more complex example, I wrote one yesterday for putting together some test data. Turns DynamoDB responses into newline separated flat arrays: pbpaste | jq -c '.actionResponses[].data.items[] | [.attributes[] | .stringValue // (.numberValue | tonumber)]'