Blog

You probably don’t need jq

2021-11-07

This article demonstrates how to query and manipulate JSON data with PowerShell. It’s inspired by an introduction to jq on the blog of Adam Gordon Bell. That piece is worth a read even if you’re already au fait with jq as it’s a good primer for the examples shown here.

All of the code samples should be ready to paste into a terminal on macOS, Windows or Linux with a recent version of PowerShell installed.

The general approach is super simple: parse the source data to PowerShell objects, process it and - optionally - convert back to JSON at the end. We could use the same technique for data from CSV files, XML, relational databases or anywhere else. That makes this workflow really powerful; you only need learn it once and it will work for pretty much any kind of data.

Read more