Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Parses a JSON file containing multiple objects that are not contained in a single object.
require 'yajl'
def parse(json_filespec)
json_file =, 'r')
parser =
records = []
parser.parse(json_file) do |x|
records << x
all_records_in_file = parse 'test.json'
puts "Found #{all_records_in_file.size} records."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment