Skip to content

Instantly share code, notes, and snippets.

@thiagogabriel
Created May 10, 2015 17:55
Show Gist options
  • Save thiagogabriel/ea25372c758f36e257ca to your computer and use it in GitHub Desktop.
Save thiagogabriel/ea25372c758f36e257ca to your computer and use it in GitHub Desktop.
require 'csv'
require 'json'
array = []
CSV.foreach('full-list.csv') do |row|
array << {
name: row[0],
address: row[1],
location: {
__type: 'GeoPoint',
latitude: row[2].to_f,
longitude: row[3].to_f
},
external_id: row[4].to_i,
city: row[5],
state: row[6],
card_type: 'VR'
}
end
results = { 'results ' => array }
File.open('temp.json','w') do |f|
f.write(results.to_json)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment