Skip to content

Instantly share code, notes, and snippets.

@Keita-N
Last active October 8, 2019 04:05
Show Gist options
  • Save Keita-N/fedfe716b3732b0e6b92d17b4b21e813 to your computer and use it in GitHub Desktop.
Save Keita-N/fedfe716b3732b0e6b92d17b4b21e813 to your computer and use it in GitHub Desktop.
require 'csv'
require 'json'
lines = readlines.join('')
json = JSON.parse(lines)
puts json.first.map{ |k,v| k }.join(',')
json.each do |node|
puts node.map { |k,v| v }.join(',')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment