dts
A simple tool to deserialize data from an input encoding, transform it and serialize it back into an output encoding.
Requires rust >= 1.56.0.
Installation from source
This is the only install option available right now.
Clone the repository and run:
cargo install --path .
Usage
dts [<source>...] [-t <transform-options>] [-O <sink>...]
For a full list of available flags and transform options consult the help:
dts --help
Examples
Convert YAML to TOML and remove empty values:
dts input.yaml -t remove-empty-values -o toml
Load all YAML files from sub directories, flatten nested arrays and merge them into one:
dts . --glob '**/*.yaml' -t flatten-arrays output.yaml
Run a JSONPath filter on the input data:
dts tests/fixtures/example.json -t jsonpath='$.users[?(@.age < 30)]'
Combine multiple transformation options (multiple usages of the same option possible):
# This uses the single char forms of the transformation options
dts tests/fixtures/example.json -t d='some_key',m,j='[*]',f,j='[*].id'
Read data from stdin:
echo '{"foo": {"bar": "baz"}}' | dts -i json -tF,r -o yaml
Supported Encodings
Right now dts
supports the following encodings:
- JSON
- YAML
- TOML
- JSON5 (deserialize only)
- CSV
- QueryString
- XML
- Text
- Gron
- HCL (deserialize only)
License
The source code of dts is released under the MIT License. See the bundled LICENSE file for details.