Extend jq for any data format. Currently supports JSON, TOML, and YAML.
By default aq behaves just like jq and operates on JSON.
$ echo '{"foo": 0}' | aq .{
"foo": 0
}But it also accepts options to specify the input and/or output format. For example with a TOML input and a YAML output:
$ echo 'foo = 0' | aq -i toml -o yaml .foo: 0Other options are forwarded to jq and can be used as normal.
$ aq -n --arg name "Alice" '{name: $name}' --output yamlname: AliceWhen the input format is not specified, it is inferred from the file extension of the input files, if stdin is used then the input format defaults to JSON. The output format always defaults to JSON.
Additionally, you can use j for JSON, t for TOML, and y for YAML for
maximum brevity. The following uses -it to specify TOML input.
$ echo '[foo]\nbar = 1337' | aq -it .foobar = 1337aq is also a multi-call binary, so if it is symlinked to tq or yq then
the input format will default to TOML or YAML respectively.
aq can be installed from my personal tap which includes pre-built
binaries.
brew install rossmacarthur/tap/aqaq can be installed from
Crates.io using
Cargo, the Rust package manager.
cargo install aq-cliIn some circumstances this can fail due to the fact that Cargo does not use
Cargo.lock file by default. You can force Cargo to use it using the --locked
option.
cargo install aq-cli --lockedPre-built binaries for macOS (x86_64), Windows, Linux (x86_64) are provided. These can be downloaded directly from the the releases page.
Alternatively, the following script can be used to automatically detect your host
system, download the required artifact, and extract the aq binary to the
given directory.
curl --proto '=https' -fLsS https://rossmacarthur.github.io/install/crate.sh \
| bash -s -- --repo rossmacarthur/aq --to ~/.local/binThis project is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.