> For the complete documentation index, see [llms.txt](https://til.yulrizka.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.yulrizka.com/unix/jq-extracting-properties-to-arrays-from-json-row-line.md).

# jq extracting properties to arrays from json row line

For example if we have a file that contains JSON object like

```
{"a": 1, "b":{"c": 11}
{"a": 2, "b":{"c": 22}}
{"a": 3, "b":{"c": 33}}
```

And you want to construct something like

```
["1", "11"]
["2", "22"]
["3", "33"]
```

You can do that with jq

```
$ cat filename.json | jq -c '[.a, .b.c]'
```

this is particularly usefull to grep something from JSON log
