Convert between data formats from the command line.
| 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.
cargo install formatforgeTwo binaries are installed:
formatforge data.json data.toml # full name
fmtf data.json data.toml # short alias# 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.tomlConvert a JSON config to TOML:
formatforge config.json config.tomlEscape XML hell:
formatforge legacy.xml modern.jsonPack data for transport, unpack for reading:
formatforge data.yaml data.cbor # pack
formatforge data.cbor data.yaml # unpackMIT — see LICENSE