Skip to content

Instantly share code, notes, and snippets.

@arjunvenkat
Created May 6, 2016 20:15
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 arjunvenkat/9fe2d4c2e88885a0e349175999122f01 to your computer and use it in GitHub Desktop.
Save arjunvenkat/9fe2d4c2e88885a0e349175999122f01 to your computer and use it in GitHub Desktop.
Parse through JSON grade output
# this file should live in the same directory as the JSON grade output
require 'json'
output = File.open( "output.txt","w" )
Dir.foreach('.') do |item|
next if item == '.' || item == '..' || item.include?('json') == false
file = File.read(item)
score = JSON.parse(file)['summary_line']
output.write("#{item} - #{score}\n")
puts "#{item} #{score}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment