Upgrading from V2
New features and breaking changes
Last updated
Was this helpful?
New features and breaking changes
Last updated
Was this helpful?
Keeps yaml comments and formatting, can specify yaml when updating.
Handles anchors!
Can print out matching paths and values when splatting, more info .
JSON output works for all commands! Yaml files with multiple documents are printed out as one JSON document per line, more info
Deep splat (**
) to match arbitrary paths and match nodes by their children, more info
In V3 users are able to better control how values are treated when updating YAML by using a new --tag
argument (see more info ). A result of this however, is that quoting values, e.g. "true" will no longer have an effect on how the value is interpreted like it did in V2.
For instance, to get the string "true" into a yaml file:
V2:
V3
In V2 this would return null, V3 does not return anything.
Similarly, reading null yaml values null
, ~
and , V2 returns null whereas V3 returns the values as is.
This is a result of taking effort not to format values coming in and out of the original YAML.
Comments can be added, and delete commands have been introduced.
V2
V3
e.g:
V2
V3
As JSON is a subset of YAML, and yq
now preserves the formatting of the passed in document, you will most likely need to use the --prettyPrint
flag to format the JSON document as idiomatic YAML. See for more info.