Skip to content

Instantly share code, notes, and snippets.

@sirkosi
Created May 29, 2014 21:44
Show Gist options
  • Save sirkosi/545ae6a99d10a939c5ed to your computer and use it in GitHub Desktop.
Save sirkosi/545ae6a99d10a939c5ed to your computer and use it in GitHub Desktop.
require 'csv'
require 'json'
csv_string = CSV.generate do |csv|
JSON.parse(File.open("foo.json").read).each do |hash|
csv << hash.values
end
end
puts csv_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment