Created
November 5, 2018 04:15
-
-
Save yihyang/c25c921ee93f6b1c61f01270b9509b9f to your computer and use it in GitHub Desktop.
Convert CSV to JSON with this simple ruby script!
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
| 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