https://github.com/oriontvv/convfmt
cli tool which can convert different formats
https://github.com/oriontvv/convfmt
cli convert json toml yaml
Last synced: 4 months ago
JSON representation
cli tool which can convert different formats
- Host: GitHub
- URL: https://github.com/oriontvv/convfmt
- Owner: oriontvv
- License: apache-2.0
- Created: 2022-06-28T09:24:22.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2026-01-05T20:03:02.000Z (6 months ago)
- Last Synced: 2026-01-09T00:32:26.438Z (6 months ago)
- Topics: cli, convert, json, toml, yaml
- Language: Rust
- Homepage: https://crates.io/crates/convfmt
- Size: 1.63 MB
- Stars: 28
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# convfmt
[](https://github.com/oriontvv/convfmt/actions/workflows/ci.yml) [](https://htmlpreview.github.io/?https://github.com/oriontvv/convfmt/coverage/htmlcov/index.html) [](https://deps.rs/repo/github/oriontvv/convfmt) [](https://crates.io/crates/convfmt)
[convfmt](https://github.com/oriontvv/convfmt) is a command line tool in rust which can convert between 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:
```
$ convfmt --help
cli tool which can convert different formats
Usage: convfmt [OPTIONS] --from --to
Options:
-f, --from [possible values: bson, csv, hjson, hocon, json, json5, jsonl, plist, ron, toml, toon, xml, yaml]
-t, --to [possible values: bson, csv, hjson, hocon, json, json5, jsonl, plist, ron, toml, toon, xml, yaml]
-c, --compact Compress output if possible (default = false)
-h, --help Print help
-V, --version Print version
```
```
$ cat cfg.yml | convfmt -f yaml -t toml > cfg.toml
$ convfmt -f json -t json < compact.json > pretty.json
$ curl https://api.github.com/users/oriontvv | convfmt -f json -t json5 > api.json5
```
By default `convfmt` tries to use `pretty` format. Enable `--compact` option for compression.
**Beware of `null`s, some formats don't support them (e.g. toml)**
## Installation:
There are few ways:
* Download latest [binary](https://github.com/oriontvv/convfmt/releases)
* Install binary using [cargo-binstall](https://github.com/cargo-bins/cargo-binstall)
```
cargo install cargo-binstall && cargo binstall convfmt
```
* Build local [crate](https://crates.io/crates/convfmt) with [rust](https://www.rust-lang.org/tools/install)
```
cargo install convfmt
```