Set a value in place with `jq`

I recently needed to set a value in a JSON file. Using jq I can do this by setting the value directly like so:

Group by fields with `jq`

Whilst working with some access logs I wanted to find out how many unique user agents were calling a given endpoint. Instead of writing a script, I wanted to see if jq could handle it - it could!

Sum values with jq

Given a set of transactions in JSON format, I wanted to work out what the sum of a specific field was.

Extract keys using JQ

Given the following input data, I needed to extract the key and the value of foo, returning it as a key/value object

Extract substring of specific values with JQ

This is probably something very specific to my use case, but I was working with some JSON that looked something like this: