Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'csv'
- require 'json'
- input = CSV.new(File.open(ARGV[0]), headers: true, header_converters: :symbol, converters: :all)
- output = input.to_a.map { |row| row.to_hash }
- File.open(ARGV[1],"w") { |f| f.write(output.to_json) }
Advertisement