Using jq to understand large Mechanic operations

For large Mechanic results, whether you're generating actions or logs, no automatic summary will be as flexible as a manual query for exactly the data you're looking for.

For this purpose, we recommend pairing event exports with jq, a tool for processing JSON.

Usage examples

Find "shopify" actions with REST usages (i.e. with an array of action options)

cat event.json | jq '.event.task_runs[].action_runs[] | select(.action_type == "shopify") | select(.action_options | type == "array")'

Count all action runs for an event whose options include the string "metafields"

$ cat event.json | jq '.event.task_runs[].action_runs[] | select(.action_options | contains("metafields"))' | jq -s '. | length'

Find an action which modified a certain customer

$ cat event.json | jq '.event.task_runs[0].action_runs[] | select(.action_options | contains("gid://shopify/Customer/1234567890"))'

Find actions of a certain type

$ cat event.json | jq '.event.task_runs[0].action_runs[] | select(.action_type == "cache")'
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.