Utility for converting data between structured formats. Currently supports following formats:
- JSON
- YAML
- TOML
- Java Properties
- Protobuf
You can download pre-built binaries from releases page. Download archive and place the content in your PATH.
Simple conversion with default options requires just the following call:
cvto -i input.json -o output.yamlcvto automatically detects formats based on file extension. If required it may be set explicitly by passing --in-format or --out-format options:
cvto -i file_with_no_extension -o output.conf --in-format json --out-format yamlPossible values for --in-format and --out-format are:
jsonyamltomlpropertiesprotobuf
You can use stdin as input and stdout as output by not passing -i or (and) -o options, but you need then set --in-format or (and) --out-format options:
cat input.json | cvto --in-format json --out-format yaml > output.yamlIf you need to configure how to serialize and deserialize input and output data, you can provide additional options which have the following naming: {format}-{type}-{name}, where:
formatmay be:jsonyamltomlpropertiesprotobuf
typemay be:inwhich means deserialization (how to parse input)outwhich means serialization (how to write to output)
nameis actual name of option
Java Properties
properties-in-mode: Processing mode. Possible values:flat: interprets properties as pure key-value passing it directly to other format representationnested: interprets properties as nested map transforming them into structured view before passing to other format representation
properties-out-kv-separator: Separator to use to determine key and value
Protobuf
protobuf-in-input: Paths to .proto files that will be used as inputsprotobuf-in-include: Paths to directories with .proto filesprotobuf-in-message: Name of the target message typeprotobuf-out-input: Paths to .proto files that will be used as inputsprotobuf-out-include: Paths to directories with .proto filesprotobuf-out-message: Name of the target message type