Last active
August 29, 2015 14:26
-
-
Save h2rd/2570b0ee8fb5b5726a1e to your computer and use it in GitHub Desktop.
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 'json' | |
| raise Exception, 'you must provide a json file' unless ARGV[0] | |
| buffer = File.open(ARGV[0]).read | |
| buffer.gsub!("\n", '') | |
| buffer.gsub!("\t", '') | |
| json = JSON.parse(buffer) | |
| puts json.first.collect {|k,v| k}.join(',') | |
| puts json.collect {|node| "#{node.collect{|k,v| v}.join(',')}\n"}.join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment