The blog about containerisation, virtual machines and useful shell snippets and findings

The simplest way to make JSON from YAML

you need to have ruby installed which is always true for macOS.

function yaml2json()
{
    ruby -ryaml -rjson -e \
         'puts JSON.pretty_generate(YAML.load(ARGF))' $*
}

usage:

yaml2json my.yml