yq's Relationship to jq

Two tools share the name. Mike Farah's yq 16,045 (github.com/mikefarah/yq (https://github.com/mikefarah/yq 16,045 ), MIT) is a single Go binary with its own jq-like engine that reads and writes YAML, JSON, XML, CSV, TSV, TOML, properties and more; it is the one this book uses (v4.53.6). Andrey Kislyuk's Python yq (Apache-2.0) converts YAML to JSON, runs the real jq 133,477 , and converts back. Mike Farah's version covers the common jq operations, not all of them, and its strength is editing YAML in place while keeping comments.

Querying and editing a commented YAML config with yqShell
cp pipeline.yaml work.yaml
yq '.targets[] | select(.format == "csv") | .name' work.yaml
yq -i '.targets[0].batch_size = 5000' work.yaml
diff pipeline.yaml work.yaml
jq -n '[1, 2, 3] | reduce .[] as $x (0; . + $x)'
yq -n '[1, 2, 3] | .[] as $x ireduce (0; . + $x)'
Output
finance
4c4
<   path: data/orders.jsonl   # JSON Lines, Section 3.2
---
>   path: data/orders.jsonl # JSON Lines, Section 3.2
9c9
<     batch_size: 1000
---
>     batch_size: 5000
11c11
<     format: parquet         # Section 3.13
---
>     format: parquet # Section 3.13
6
6

The edit kept both comments but normalized their spacing, which is what the project's documentation warns of: it preserves comments "as much as possible". Folding also differs: jq's reduce becomes yq's ireduce, written after the as binding. Use jq for heavy JSON processing and yq for YAML files that humans also edit.