Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
April 11, 2022 21:13
April 8, 2022 02:22
April 8, 2022 02:22
April 8, 2022 02:22
March 23, 2022 21:12
April 11, 2022 21:28
January 22, 2019 23:36
April 26, 2022 21:55
April 11, 2022 21:28
April 12, 2022 20:41
April 8, 2022 02:22


GoDoc Tests

Packaging status

Convert between YAML, TOML, JSON, and HCL.

Preserves map order.

Format versions:

  • YAML: v1.2 (
  • TOML: v1.0.0 (
  • JSON: RFC 7159 (encoding/json)
  • HCL: v1 (
$ yj -h
Usage: yj [-][ytjcrneikhv]

Convert between YAML, TOML, JSON, and HCL.
Preserves map order.

-x[x]  Convert using stdin. Valid options:
          -yj, -y = YAML to JSON (default)
          -yy     = YAML to YAML
          -yt     = YAML to TOML
          -yc     = YAML to HCL
          -tj, -t = TOML to JSON
          -ty     = TOML to YAML
          -tt     = TOML to TOML
          -tc     = TOML to HCL
          -jj     = JSON to JSON
          -jy, -r = JSON to YAML
          -jt     = JSON to TOML
          -jc     = JSON to HCL
          -cy     = HCL to YAML
          -ct     = HCL to TOML
          -cj, -c = HCL to JSON
          -cc     = HCL to HCL
-n     Do not covert inf, -inf, and NaN to/from strings (YAML or TOML only)
-e     Escape HTML (JSON out only)
-i     Indent output (JSON or TOML out only)
-k     Attempt to parse keys as objects or numeric types (YAML out only)
-h     Show this help message
-v     Show version



The yj CLI is available via Homebrew:

brew install yj


Binaries for macOS, Linux, and Windows are attached to each release.


yj is also available as a Docker image.

Go Package

Packages contained in this repo may also be used to convert all supported data formats to a normalized tree of ordered Go objects.

See godoc for details.

NOTE: The current Go API should not be considered stable.