Created
May 25, 2017 20:28
-
-
Save piyushranjan/3cf105544ed5ee6618e3f9ef4cac3710 to your computer and use it in GitHub Desktop.
This file contains 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 "json" | |
csv_file = File.open("processedcr.csv", "w") | |
CSV.build(csv_file) do |csv| | |
Dir.foreach("natural"){|f| | |
file = File.join("natural", f) | |
next unless File.file?(file) | |
next if File.size(file) == 0 | |
json_str = File.read(file) | |
begin | |
puts file | |
json = JSON.parse(json_str.to_s) | |
rescue | |
next | |
end | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment