Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piyushranjan/3cf105544ed5ee6618e3f9ef4cac3710 to your computer and use it in GitHub Desktop.
Save piyushranjan/3cf105544ed5ee6618e3f9ef4cac3710 to your computer and use it in GitHub Desktop.
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