Created
May 11, 2016 17:17
-
-
Save egoens/d34660e2be399c257941da0447565385 to your computer and use it in GitHub Desktop.
YML to JSON
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# as file yml_to_json.rb | |
require 'yaml' | |
require 'json' | |
output = File.open('new_file_name.json','w') | |
output << JSON.pretty_generate(YAML.load_file('./yaml_file.yml')) | |
output.close | |
# one liner | |
ruby -e "require 'yaml';require 'json';output = File.open('new_file_name.json','w');output << JSON.pretty_generate(YAML.load_file('./yaml_file.yml'));output.close" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment