Skip to content

glpetrikov/formatforge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

formatforge

Convert between data formats from the command line.

Crates.io License: MIT

Supported formats

Format Extension Notes
JSON .json
TOML .toml No null values
YAML .yaml, .yml
XML .xml
ENV .env Key=value pairs
KDL .kdl kdl-lang.com
CBOR .cbor Binary format
INI .ini
JSON5 .json5 Comments, trailing commas
JSONC .jsonc JSON with comments
MessagePack .msgpack Binary format

Note: TOML and XML may not preserve key/attribute order after conversion.

Installation

cargo install formatforge

Aliases

Two binaries are installed:

formatforge data.json data.toml  # full name
fmtf data.json data.toml         # short alias

Usage

# Format is detected automatically from file extension
formatforge input.json output.toml
formatforge config.yaml config.json
formatforge data.toml data.yaml

# Pack to binary
formatforge data.json data.cbor
formatforge data.json data.msgpack

# Unpack from binary
formatforge data.cbor data.json
formatforge data.msgpack data.toml

# Override format manually
formatforge data.json out.yaml --to yaml
formatforge input --from json output.toml

Examples

Convert a JSON config to TOML:

formatforge config.json config.toml

Escape XML hell:

formatforge legacy.xml modern.json

Pack data for transport, unpack for reading:

formatforge data.yaml data.cbor    # pack
formatforge data.cbor data.yaml    # unpack

License

MIT — see LICENSE

Links

About

Convert between data formats: JSON, TOML, YAML, XML, ENV, KDL, CBOR, INI, JSON5, JSONC, MessagePack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages