-
-
Save epcim/f71a286c562f65413cc846fa18686d39 to your computer and use it in GitHub Desktop.
Convert a csv to json
This file contains hidden or 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
#! /usr/bin/env ruby | |
require 'csv' | |
require 'json' | |
csv = CSV.parse(File.read(file_name).scrub, headers: true) | |
hash = csv.map{ |row| { code: row["Classification Code"], description: row["Classification Code Description English"] } } | |
json = hash.to_json | |
File.write(new_file_name, json) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment