Utilities for use on the command line, to convert CSV, TOML, XML & YAML to JSON. For each supported format there is a tool for use in a pipe as well as a jq wrapper which passes the converted input or files in the arguments to jq, for further querying and processing.
Usage examples:
$ echo foo: bar | yaml2json
{"foo":"bar"}
$ tq -r .package.description Cargo.toml
CLI utilities to convert CSV, TOML, XML & YAML into JSON on standard output or into jq.
Goals: + provide light-weight converters to JSON + provide jq wrappers + add support for additional formats having maintained Serde implementations
Non-Goals: - converting JSON into other data formats, consider jyt - replicating jq, jq must be installed to use the jq wrappers
Alternatives: * Rust 🦀: * jyt * yaml2json * yaml2json-rs * Go 🐹 * JavaScript 🌐 * Python 🐍
To Do: - [ ] csv arguments for delimiter, flexible fields, quote, terminator, escape characters
You may not want to install all of the utilities or only a particular one. Each utility can be selected by itself or via group features. If no features are selected, all utilities get installed.
Matrix of all selectable features: | | to_json | jq | |------|-----------|----| | csv | csv2json | cq | | toml | toml2json | tq | | xml | xml2json | xq | | yaml | yaml2json | yq |
Examples:
# install only yq & tq:
cargo install convert2json --no-default-features --features yq,tq
# install all the xml related tools:
cargo install convert2json --no-default-features --features xml