Created
March 23, 2012 14:10
-
-
Save wrburgess/2170970 to your computer and use it in GitHub Desktop.
Parse json to csv in ruby
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
require 'csv' | |
require 'json' | |
csv_string = CSV.generate do |csv| | |
JSON.parse(File.open("filename.json").read).each do |hash| | |
data = hash[1] | |
theline = theline + " #{data}," | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment