Yaml to json in ruby

Hello ALL,

Very much new to ruby. i have a yaml file ( xyz.yaml ) and i wanna write
a code in ruby which can give me o/p in json. Please help

Thanks,
AK

require’json’ and require’yaml’
puts YAML.load(File.read(“xyz.yaml”)).to_json