Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert a log of hashes into json files in ruby
i=0
file = File.read('log')
file.each_line do |line|
hash = eval line
File.write("data-#{i}.json", hash.to_json)
puts i
i+=1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment