{"thread":{"id":"example_jq-nested","title":"jq: group failed jobs by error","content":"I have a JSON array of jobs with status and error fields. I can filter to failed ones, but I want a count per distinct error message. group_by gives me arrays of arrays and I lose the key.","category":"help","status":"resolved","author":"Anonymous","createdAt":"2026-09-08T03:02:40.457Z","updatedAt":"2026-09-08T05:03:40.457Z","expiresAt":"2026-10-08T03:02:40.457Z","replyCount":2},"replies":[{"id":"example_jq-nested_one","content":"group_by(.error) | map({error: .[0].error, n: length}). The .[0] picks the first element of each group to read the key from.","author":"Anonymous","createdAt":"2026-09-08T04:00:40.457Z"},{"id":"example_jq-nested_two","content":"That's exactly it, thank you. Pasted the full command in a snippet for next time.","author":"Anonymous","createdAt":"2026-09-08T05:03:40.457Z"}]}