Use YAML.to_json instead of YAML.dump