title: Parse large JSON hash with ruby-yajl?
body: <p>I have a large file (>50Mb) which contains a JSON hash. Something like:</p>
  
  <pre><code>{ 
    "obj1": {
      "key1": "val1",
      "key2": "val2"
    },
    "obj2": {
      "key1": "val1",
      "key2": "val2"
    }
    ...
  }
  </code></pre>
  
  <p>Rather than parsing the entire file and taking say the first ten elements, I'd like to parse each item in the hash. I actually don't care about the key, i.e. <code>obj1</code>. </p>
  
  <p>If I convert the above to this:</p>
  
  <pre><code>  {
      "key1": "val1",
      "key2": "val2"
    }
    "obj2": {
      "key1": "val1",
      "key2": "val2"
    }
  </code></pre>
  
  <p>I can easily achieve what I want using Yajl streaming:</p>
  
  <pre><code>io = File.open(path_to_file)
  count = 10
  Yajl::Parser.parse(io) do |obj|
    puts "Parsed: #{obj}"
    count -= 1
    break if count == 0
  end
  io.close
  </code></pre>
  
  <p>Is there a way to do this without having to alter the file? Some sort of callback in Yajl maybe?</p>