Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yoshihitoh/refmt
Translate data format into another one. Currently only JSON and YAML are available.
https://github.com/yoshihitoh/refmt
cli command-line command-line-tool converter json utility yaml
Last synced: 2 months ago
JSON representation
Translate data format into another one. Currently only JSON and YAML are available.
- Host: GitHub
- URL: https://github.com/yoshihitoh/refmt
- Owner: yoshihitoh
- License: mit
- Created: 2018-12-31T14:40:16.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-13T20:58:02.000Z (almost 2 years ago)
- Last Synced: 2024-08-03T09:11:54.544Z (6 months ago)
- Topics: cli, command-line, command-line-tool, converter, json, utility, yaml
- Language: Rust
- Size: 1020 KB
- Stars: 27
- Watchers: 1
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# refmt
[![Build Status](https://travis-ci.org/yoshihitoh/refmt.svg?branch=master)](https://travis-ci.org/yoshihitoh/refmt)refmt is a data format translation tool written in Rust. Currently only JSON, YAML and TOML are available.
# Syntax highlighting
refmt supports syntax highlighting.![Syntax highlighting example](https://i.imgur.com/vSlsRAC.png)
# Installation
refmt is written ins Rust, so you need Rust toolchains. refmt compiled with Rust 1.30.0 (stable) or newer.To build refmt:
```bash
$ git clone https://github.com/yoshihitoh/refmt
$ cd refmt
$ cargo build --release
$ ./target/release/refmt --version
refmt 0.1.2
```# Usage
``` bash
$ ./target/release/refmt --help
refmt 0.1.2
yoshihitoh
Translate data format into another one.USAGE:
refmt [OPTIONS]FLAGS:
-h, --help Prints help information
-V, --version Prints version informationOPTIONS:
-i, --input set the input file to use
--input-format set the name of input format [possible values: json, yaml]
-o, --output set the output file to use
--output-format set the name of output format [possible values: json, yaml]
```# Examples
## JSON to YAML
``` bash
$ echo '{"id": 1, "name": {"first": "John", "last": "Doe"}}' | ./target/release/refmt --input-format json --output-format yaml
---
id: 1
name:
first: John
last: Doe
```## YAML to JSON
``` bash
$ cat < ---
> id: 1
> name:
> first: John
> last: Doe
> EOS
{
"id": 1,
"name": {
"first": "John",
"last": "Doe"
}
}
```## JSON to TOML
``` bash
$ echo '{"id": 1, "name": {"first": "John", "last": "Doe"}}' | refmt --input-format json --output-format toml
id = 1[name]
first = 'John'
last = 'Doe'```
# Running tests
```bash
$ cargo test --all
```