TOML → JSON on the command line with fx (aka “toml to json cli”)
Fx understands TOML. That means you can convert TOML to JSON (and query it) straight from your terminal—no extra tools.
Quick start: TOML to JSON
Pretty-print TOML as JSON:
bash
fx config.tomlSave JSON to a file:
bash
fx config.toml > config.jsonRead from stdin:
bash
cat Cargo.toml | fx --tomlQuery fields (using JS expressions)
bash
fx Cargo.toml '.package.name'
fx Cargo.toml 'Object.keys(x.dependencies)'Notes
- Fx auto-detects TOML by filename; you can also pipe TOML via stdin with
--tomlflag. - Comments in TOML are ignored (JSON has no comments).
- Preserves order of keys in objects.
- Works the same way with JSON and YAML, so one tool covers them all.
Fx is a fast, simple way to convert and explore TOML on the command line.