Skip to content

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.toml .

Save JSON to a file:

bash
fx config.toml . > config.json

Read from stdin:

bash
cat Cargo.toml | fx --toml .

To explore the file interactively instead, run fx config.toml without arguments.

Query 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 --toml flag.
  • 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.