More jq fun

I've written about jq before, but I mention it again here as a very useful tool for parsing JSON on the command line.

I needed to grab some England Bank holidays for a quick hack the other day and found that the GOV.UK team made web better by allowing you to append .json to any of their links to get to the data.

Hold onto yer hats:

for D in $(curl | \
  jq '.["england-and-wales"].events[] | .date') ;do \
  echo "new DateTime($D)," ; done

# Renders this:
new DateTime("2012-01-02"),
new DateTime("2012-04-06"),
// ... snip
new DateTime("2015-12-28"),