jknife

jyaml

YAML helper tool — validate yaml and convert it to json.

Usage

jyaml validate [yaml]    # validate, silent on success
jyaml tojson [yaml]       # convert to json

If no YAML argument is given, the input is read from stdin.

Examples

jyaml validate config.yaml && echo "valid"

jyaml tojson 'a: 1'
# {"a":1}

jyaml tojson config.yaml | jjson pretty
jyaml tojson -p config.yaml > config.json   # pretty output

cat values.yaml | jyaml tojson | jq .

# multi documents are not merged: only the first is loaded

Notes:

Options

Exit codes: 0 success, 2 invalid yaml.

Install

brew tap mhus/jknife
brew install jyaml

Or download the binary for your platform from the releases.