Jq
Jump to navigation
Jump to search
jq
jq https://jqlang.github.io/jq/
jq is a lightweight and flexible command-line JSON processor.
jq is like sed for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.
pretty print json
echo '{"foo": "lorem", "bar": "ipsum"}' | jq
tutorial
jq tutorial https://jqlang.github.io/jq/tutorial/
jq change case
.key|ascii_uppercase
.key|ascii_downcase
Examples:
.results[]|select ((.key|ascii_downcase)=="answer")|.value
.results[]|select ((.key|ascii_downcase)=="answer")|{"answer":.value}
ref: https://discuss.rapid7.com/t/reformatting-data-with-the-jq-plugin/4551
cheat sheet
jq cheat sheet https://developer.zendesk.com/documentation/integration-services/developer-guide/jq-cheat-sheet/