Skip to content

Instantly share code, notes, and snippets.

@bobbrez
Last active December 14, 2015 15:58
Show Gist options
  • Save bobbrez/5111532 to your computer and use it in GitHub Desktop.
Save bobbrez/5111532 to your computer and use it in GitHub Desktop.
Simple script to read json and output a table.
#!/usr/bin/env ruby
require 'rubygems'
require 'terminal-table'
require 'json'
require 'hashie'
require 'csv'
data = Hashie::Mash.new JSON.parse(ARGF.read)
CSV.open('uvr.csv', 'w') do |csv|
csv << ['oid', 'uvr']
data.response.data.orgs.each_value do |val|
csv << [val.oid, val.uvr]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment