Skip to content

Instantly share code, notes, and snippets.

@ravibhure
Created September 27, 2013 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ravibhure/6725229 to your computer and use it in GitHub Desktop.
Save ravibhure/6725229 to your computer and use it in GitHub Desktop.
table view on terminal from json output
#!/usr/bin/env ruby
require 'rubygems'
require 'terminal-table'
require 'json'
rows = []
data = JSON.parse(ARGF.read)
data.each do |record|
rows << record.values
end
puts Terminal::Table.new :headings => data.first.keys, :rows => rows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment