Skip to content

Instantly share code, notes, and snippets.

@wgins
Created September 28, 2019 19:44
Show Gist options
  • Save wgins/e123992d50c66be8f2c41f1a52f748ec to your computer and use it in GitHub Desktop.
Save wgins/e123992d50c66be8f2c41f1a52f748ec to your computer and use it in GitHub Desktop.
yaml to json
# create json dir and convert all .yaml files in current dir to json
# move all .json files into newly created json dir
mkdir json
for file in *.yaml
do
ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' < "$file" > "${file/.yaml/.json}"
mv *.json json/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment