jq, but with many interoperable configuration format transcodings and interactive querying.
jq, but with many interoperable configuration format transcodings and interactive querying.
qq is a multi-format transcoder and query tool powered by jq syntax. It lets you query and convert between configuration and data formats without needing separate tools for each one.
Supported formats (read/write): .json, .yaml/.yml, .toml, .xml, .hcl/.tf, .csv, .tsv, .ini, .properties, .gron, .html, .jsonl/.ndjson/.jsonlines, .jsonc, .parquet, .msgpack/.mpk, .cbor, .avro, .base64/.b64, .txt/.text,
Read-only: .proto, .env
Any input format can be transcoded to any output format in a single command. Use -i/--input and -o/--output to specify formats explicitly, or let qq detect them from the file extension.
# YAML → JSON
qq '.' config.yaml -o json
# TOML → YAML
qq '.' pyproject.toml -o yaml
# CSV → Parquet
qq '.' data.csv -o parquet
# Avro → JSON (schema embedded in OCF file)
qq '.' events.avro
# JSON → CBOR
qq '.' payload.json -o cbor
# XML → TOML
qq '.root' config.xml -o toml
# Terraform HCL → JSON (useful for scripting)
qq '.' infra.tf -o json
# Pipe formats freely
cat file.msgpack | qq -i msgpack -o yamlHere's some example usage, this emphasises the interactive mode for demonstration, but qq is designed for usage in shell scripts.
…You can also use it for cleaner diffing of configuration files by adding to your git/config file a snippet such as
…and to git/attributes correspondingly
*.csv diff=csv
*.env diff=env
*.html diff=html
*.ini diff=ini
*.toml diff=tomlFrom brew:
brew install jfryy/tap/qqFrom AUR (ArchLinux):
yay qq-gitFrom source (requires go >=1.22.4)
make installDownload at releases here.
Docker quickstart:
# install the image
docker pull jfryy/qq
# run an example
echo '{"foo":"bar"}' | docker run -i jfryy/qq '.foo = "bazz"' -o tfqq is inspired by fq and jq. jq is a powerful and succinct query tool, sometimes I would find myself needing to use another bespoke tool for another format than json, whether its something dedicated with json query built in or a simple converter from one configuration format to json to pipe into jq. qq aims to be a handly utility on the terminal or in shell scripts that can be used for most interaction with structured formats in the terminal. It can transcode configuration formats interchangeably between one-another with the power of jq and it has an an interactive repl (with automcomplete) to boot so you can have an interactive experience when building queries optionally. Many thanks to the authors of the libraries used in this project, especially jq, gojq, gron and fq for direct usage and/or inspiration for the project.
--stream) (identical to jq's --stream), plus extended support for JSONL, YAML, CSV, TSV, and line-delimited formats - all emit path-value pairs for memory-efficient processing of large files.qq is broad, but performant encodings are still a priority, execution is quite fast despite covering a broad range of codecs. qq performs comparitively with dedicated tools for a given format.All contributions are welcome to qq, especially for upkeep/optimization/addition of new encodings.
This tool would not be possible without the following projects, this project is arguably more of a composition of these projects than a truly original work, with glue code, some dedicated encoders/decoders, and the interactive mode being original work. Nevertheless, I hope this project can be useful to others, and I hope to contribute back to the community with this project.
gojq is a pure Go implementation of jq. It is used to power the query engine of qq.jq like tool for querying a wide array of binary formats.jq is a lightweight and flexible command-line JSON processor.No open issues yet, or sync has not completed.