|
|
|
|
|
by fivea
1621 days ago
|
|
> For example how would you take key k1 from a list of dicts [{k1: v1, k2: v2}, {k1: v3}]? Do you mean something like: .[].k1
Give it a try.https://jqplay.org/ jq does have a learning curve, but just like any query language, including SQL, first you need to learn the basics of the query language in order to get things to work. In this case: * you know that .[] iterates over objects, so you use it to unpack the root array, * you know you get a stream of objects, thus from those you use the .k1 filter to get the values of each k1 key. Here's jq's manual on basic filters: https://stedolan.github.io/jq/manual/#Basicfilters After you get jq to filter out what you want, you can work on getting it to output results in whatever format you wish. |
|