YAML to JSON - one-liner with Ruby
# Single line of Ruby <3. | |
ruby -rjson -ryaml -e "puts YAML.load_file('my_file.yml').to_json" | |
# You can also pipe it to Python to get pretty ouput | |
ruby -rjson -ryaml -e "puts YAML.load_file('my_file.yml').to_json" | \ | |
python -mjson.tool | |
# Thats all. :) |
This comment has been minimized.
This comment has been minimized.
I'd like to load all yml from a relative path to json: |
This comment has been minimized.
This comment has been minimized.
This works, however, unlike the
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Or if you want pretty-printed JSON without python: