refmt is a data format translation tool written in Rust. Currently only JSON, YAML and TOML are available.
refmt supports syntax highlighting.
refmt is written ins Rust, so you need Rust toolchains. refmt compiled with Rust 1.30.0 (stable) or newer.
To build refmt:
$ git clone https://github.com/yoshihitoh/refmt
$ cd refmt
$ cargo build --release
$ ./target/release/refmt --version
refmt 0.1.2
$ ./target/release/refmt --help
refmt 0.1.2
yoshihitoh <[email protected]>
Translate data format into another one.
USAGE:
refmt [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-i, --input <FILE> set the input file to use
--input-format <FORMAT_NAME> set the name of input format [possible values: json, yaml]
-o, --output <FILE> set the output file to use
--output-format <FORMAT_NAME> set the name of output format [possible values: json, yaml]
$ echo '{"id": 1, "name": {"first": "John", "last": "Doe"}}' | ./target/release/refmt --input-format json --output-format yaml
---
id: 1
name:
first: John
last: Doe
$ cat <<EOS | ./target/release/refmt --input-format yaml --output-format json
> ---
> id: 1
> name:
> first: John
> last: Doe
> EOS
{
"id": 1,
"name": {
"first": "John",
"last": "Doe"
}
}
$ echo '{"id": 1, "name": {"first": "John", "last": "Doe"}}' | refmt --input-format json --output-format toml
id = 1
[name]
first = 'John'
last = 'Doe'
$ cargo test --all