Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

wcl convert

Convert between WCL and other configuration formats.

Usage

wcl convert <file> --to <format>
wcl convert <file> --from <format>

Options

FlagDescription
--to <format>Convert WCL to the target format: json, yaml, or toml
--from <format>Convert the source format to WCL: json

Description

wcl convert handles bidirectional conversion between WCL and common configuration formats.

WCL to another format (--to): the document is fully evaluated through the pipeline and the resolved output is serialized. The result is equivalent to wcl eval --format <format>.

Another format to WCL (--from): the input file is parsed as the given format and a WCL document is generated that represents the same data. The generated WCL uses plain attribute assignments and blocks — no macros, expressions, or schemas are introduced.

Output is written to stdout. Redirect to a file to save the result.

Supported Formats

FormatTo WCL (--from)From WCL (--to)
JSONYesYes
YAMLNoYes
TOMLNoYes

Examples

Convert WCL to JSON:

wcl convert config.wcl --to json

Convert WCL to YAML:

wcl convert config.wcl --to yaml

Convert WCL to TOML:

wcl convert config.wcl --to toml

Convert JSON to WCL:

wcl convert config.json --from json

Save the result to a file:

wcl convert config.wcl --to json > config.json
wcl convert config.json --from json > config.wcl