I recently needed to set a value in a JSON file. Using
jq I can do this by setting the value directly like so:
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!
Given a set of transactions in JSON format, I wanted to work out what the sum of a specific field was.
Given the following input data, I needed to extract the key and the value of
foo, returning it as a key/value object