table of contents
YQ(1) | User Commands | YQ(1) |
NAME¶
yq - Command-line YAML processor - jq wrapper for YAML documents
SYNOPSIS¶
jq [options] <jq filter> [file...]
DESCRIPTION¶
usage: yq [options] <jq filter> [input file...]
- [--indentless-lists] [--explicit-start] [--explicit-end] [--in-place] [--version] [jq_filter] [files ...]
yq: Command-line YAML processor - jq wrapper for YAML documents
yq transcodes YAML documents to JSON and passes them to jq. See https://github.com/kislyuk/yq for more information.
positional arguments:¶
- jq_filter files
options:¶
- -h, --help
- show this help message and exit
- --yaml-output, --yml-output, -y
- Transcode jq JSON output back into YAML and emit it
- --yaml-roundtrip, --yml-roundtrip, -Y
- Transcode jq JSON output back into YAML and emit it. Preserve YAML tags and styles by representing them as extra items in their enclosing mappings and sequences while in JSON. This option is incompatible with jq filters that do not expect these extra items.
- --yaml-output-grammar-version, --yml-out-ver {1.1,1.2}
- When using --yaml-output, specify output grammar (the default is 1.1 and will be changed to 1.2 in a future version). Setting this to 1.2 will cause strings like 'on' and 'no' to be emitted unquoted.
- --width, -w WIDTH
- When using --yaml-output, specify string wrap width
- --indentless-lists, --indentless
- When using --yaml-output, indent block style lists (sequences) with 0 spaces instead of 2
- --explicit-start
- When using --yaml-output, always emit explicit document start ("---")
- --explicit-end
- When using --yaml-output, always emit explicit document end ("...")
- --in-place, -i
- Edit files in place (no backup - use caution)
- --version
- show program's version number and exit
jq - commandline JSON processor [version 1.7]
- jq [options] --args <jq filter> [strings...] jq [options] --jsonargs <jq filter> [JSON_TEXTS...]
jq is a tool for processing JSON inputs, applying the given filter to its JSON text inputs and producing the filter's results as JSON on standard output.
The simplest filter is ., which copies jq's input to its output unmodified except for formatting. For more advanced filters see the jq(1) manpage ("man jq") and/or https://jqlang.github.io/jq/.
Example:
- $ echo '{"foo": 0}' | jq .
- {
- "foo": 0
- }
Command options:¶
- -n, --null-input
- use `null` as the single input value;
- -R, --raw-input
- read each line as string instead of JSON;
- -s, --slurp
- read all inputs into an array and use it as the single input value;
- -c, --compact-output
- compact instead of pretty-printed output;
- -r, --raw-output
- output strings without escapes and quotes;
- --raw-output0
- implies -r and output NUL after each output;
- -j, --join-output
- implies -r and output without newline after each output;
- -a, --ascii-output
- output strings by only ASCII characters using escape sequences;
- -S, --sort-keys
- sort keys of each object on output;
- -C, --color-output
- colorize JSON output;
- -M, --monochrome-output
- disable colored output;
- --tab
- use tabs for indentation;
- --indent n
- use n spaces for indentation (max 7 spaces);
- --unbuffered
- flush output stream after each output;
- --stream
- parse the input value in streaming fashion;
- --stream-errors
- implies --stream and report parse error as an array;
- --seq
- parse input/output as application/json-seq;
- -f, --from-file file
- load filter from the file;
- -L directory
- search modules from the directory;
- --arg name value
- set $name to the string value;
- --argjson name value
- set $name to the JSON value;
- --slurpfile name file set $name to an array of JSON values read
- from the file;
- --rawfile name file
- set $name to string contents of file;
- --args
- consume remaining arguments as positional string values;
- --jsonargs
- consume remaining arguments as positional JSON values;
- -e, --exit-status
- set exit status code based on the output;
- -V, --version
- show the version;
- --build-configuration
- show jq's build configuration;
- -h, --help
- show the help;
- --
- terminates argument processing;
Named arguments are also available as $ARGS.named[], while positional arguments are available as $ARGS.positional[].
SEE ALSO¶
The full documentation for yq is maintained as a Texinfo manual. If the info and yq programs are properly installed at your site, the command
- info yq
should give you access to the complete manual.
May 2025 | yq 3.4.3 |