Convert JSON to YAML Using Ruby

From Bonus Bits
Jump to: navigation, search

Purpose

This article gives options for converting JSON to YAML using Ruby.


Prerequisites

  • Ruby


CLI

ruby -ryaml -rjson -e 'puts YAML.dump(JSON.parse(STDIN.read))' < file.json > file.yaml