# fmtcnv 2.3.1
[](https://github.com/pepa65/fmtcnv/actions/workflows/ci.yml) [](https://htmlpreview.github.io/?https://github.com/pepa65/fmtcnv/coverage/htmlcov/index.html) [](https://deps.rs/repo/github/pepa65/fmtcnv) [](https://crates.io/crates/fmtcnv)
The command line tool [fmtcnv](https://github.com/pepa65/fmtcnv) converts between these formats:
* [bson](https://en.wikipedia.org/wiki/BSON)
* [csv](https://en.wikipedia.org/wiki/Comma-separated_values)
* [hjson](https://hjson.github.io/)
* [hocon](https://github.com/lightbend/config/blob/main/HOCON.md)
* [json](https://en.wikipedia.org/wiki/JSON)
* [json5](https://en.wikipedia.org/wiki/JSON5)
* [jsonl](https://jsonltools.com/what-is-jsonl)
* [plist](https://en.wikipedia.org/wiki/Property_list)
* [ron](https://github.com/ron-rs/ron)
* [toml](https://en.wikipedia.org/wiki/TOML)
* [toon](https://toonformat.dev/)
* [xml](https://en.wikipedia.org/wiki/XML)
* [yaml](https://en.wikipedia.org/wiki/YAML)
## Usage
```
fmtcnv 2.3.1 - Cross-convert bson, csv, hjson, hocon, json, json5, jsonl, plist, ron, toml, toon, xml, yaml
Convert formats from stdin to stdout. Repo: github.com/pepa65/fmtcnv
Usage: fmtcnv [OPTIONS] --from <FROM> --to <TO>
Options:
-f, --from <FROM> [possible values: bson, csv, hjson, hocon, json, json5, jsonl, plist, ron, toml, toon, xml, yaml]
-t, --to <TO> [possible values: bson, csv, hjson, hocon, json, json5, jsonl, plist, ron, toml, toon, xml, yaml]
-c, --compact Compact output as much as possible [default: false]
-h, --help Print help
-V, --version Print version
```
## Examples
```
cat cfg.yml |fmtcnv -f yaml -t toml >cfg.toml
fmtcnv -f json -t json <compact.json >pretty.json
curl https://api.github.com/users/pepa65 |fmtcnv -f json -t json5 # Output on stdout
```
**Beware of `null` values, as some formats (toml!) don't support them.**
## Installation
* Download latest [binary](https://github.com/pepa65/fmtcnv/releases)
* Install binary using [cargo-binstall](https://github.com/cargo-bins/cargo-binstall):
`cargo install cargo-binstall && cargo binstall fmtcnv`
* Build [crate](https://crates.io/crates/fmtcnv) from crates.io with [rust](https://www.rust-lang.org/tools/install):
`cargo install fmtcnv`
* Build [repo](https://github.com/pepa65/fmtcnv) locally with [rust](https://www.rust-lang.org/tools/install):
```
git clone https://github.com/pepa65/fmtcnv
cd fmtcnv
cargo rel
```