• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

convert/H25-Jul-2020-284241

hcl/H25-Jul-2020-126113

order/H25-Jul-2020-7566

testdata/H25-Jul-2020-749653

toml/H03-May-2022-289253

vendor/H03-May-2022-46,06536,351

yaml/H25-Jul-2020-427360

.gitignoreH A D25-Jul-202041 65

.travis.ymlH A D25-Jul-2020149 1211

DockerfileH A D25-Jul-2020246 109

LICENSEH A D25-Jul-202011.1 KiB202169

README.mdH A D25-Jul-20201.7 KiB5142

flags.goH A D25-Jul-20203.8 KiB177151

flags_test.goH A D25-Jul-20201.5 KiB6049

go.modH A D25-Jul-2020281 128

go.sumH A D25-Jul-2020987 1110

main.goH A D25-Jul-20201.8 KiB7666

main_test.goH A D25-Jul-20202 KiB7765

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.