Skip to content

Instantly share code, notes, and snippets.

@yihyang
Created November 5, 2018 04:15
Show Gist options
  • Select an option

  • Save yihyang/c25c921ee93f6b1c61f01270b9509b9f to your computer and use it in GitHub Desktop.

Select an option

Save yihyang/c25c921ee93f6b1c61f01270b9509b9f to your computer and use it in GitHub Desktop.
Convert CSV to JSON with this simple ruby script!
require 'csv'
require 'json'
reading_filename = 'input.csv'
output_filename = 'output.json'
arr = CSV.read(reading_filename)
File.open(output_filename, 'w') do |f|
f.write(arr.to_json)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment