CLI Reference

The TOON Converter command-line interface (CLI) provides a comprehensive set of tools for file conversion, analysis, and optimization.

Global Options

  • --version: Show the version and exit.

  • --help: Show help message and exit.

Commands

convert

Convert data between formats.

toon convert input.json output.toon --from json --to toon

# Use compact encoding
toon convert data.json data.toon --from json --to toon --compact

encode

Encode a file to TOON format. Automatically detects input format from extension.

toon encode input.yaml -o output.toon

# Print to stdout
toon encode input.json

decode

Decode a TOON file to another format (default JSON).

toon decode data.toon -o data.json
toon decode data.toon --format yaml

analyze

Compare token usage across multiple formats.

toon analyze data.json

# Compare specific formats
toon analyze data.json -c json -c yaml -c toon -c xml

deduplicate

(New in v2.1) Semantic deduplication of lists within data.

toon deduplicate data.json -o clean.json --threshold 0.9

infer

Infer a schema from a data file.

toon infer data.json -o schema.json

validate

Validate data against a schema.

toon validate data.json --schema schema.json

schema-merge

(New in v2.1) Merge multiple schema files into a single unified schema.

toon schema-merge s1.json s2.json -o merged.json

diff

Compare two data files structurally.

toon diff file1.json file2.json

compress / decompress

Apply Smart Dictionary Compression (SDC) to data.

toon compress big_data.json -o compressed.json
toon decompress compressed.json -o original.json

formats

List all supported formats.

toon formats