README.md
1# yj
2
3[![Build Status](https://travis-ci.org/sclevine/yj.svg?branch=master)](https://travis-ci.org/sclevine/yj)
4[![GoDoc](https://godoc.org/github.com/sclevine/yj?status.svg)](https://godoc.org/github.com/sclevine/yj)
5
6Convert between YAML, TOML, JSON, and HCL.
7
8Preserves map order.
9
10Format versions:
11- YAML: **v1.2** (gopkg.in/yaml.v3)
12- TOML: **v1.0.0-rc.1** (github.com/pelletier/go-toml)
13- JSON: **RFC 7159** (encoding/json)
14- HCL: **v1** (github.com/hashicorp/hcl)
15
16```
17opal:yj stephen$ yj -h
18Usage: yj [-][ytjcrneikhv]
19
20Convert between YAML, TOML, JSON, and HCL.
21Preserves map order.
22
23-x[x] Convert using stdin. Valid options:
24 -yj, -y = YAML to JSON (default)
25 -yy = YAML to YAML
26 -yt = YAML to TOML
27 -yc = YAML to HCL
28 -tj, -t = TOML to JSON
29 -ty = TOML to YAML
30 -tt = TOML to TOML
31 -tc = TOML to HCL
32 -jj = JSON to JSON
33 -jy, -r = JSON to YAML
34 -jt = JSON to TOML
35 -jc = JSON to HCL
36 -cy = HCL to YAML
37 -ct = HCL to TOML
38 -cj, -c = HCL to JSON
39 -cc = HCL to HCL
40-n Do not covert inf, -inf, and NaN to/from strings (YAML or TOML only)
41-e Escape HTML (JSON out only)
42-i Indent output (JSON or TOML out only)
43-k Attempt to parse keys as objects or numbers types (YAML out only)
44-h Show this help message
45-v Show version
46```
47
48The CLI is also available as a Docker image on [Docker Hub](https://hub.docker.com/r/sclevine/yj).
49
50Packages contained in this repo may also be used to convert all supported data formats to a normalized tree of ordered Go objects.
51See [godoc](https://godoc.org/github.com/sclevine/yj) for details.