title: Ruby json parse error: unexpected token
body: <p>I have a working method that opens and parses a json file. Now I'm trying to iterate through a directory of json files and display their contents.</p>
  
  <p>Working method for a single file:</p>
  
  <pre><code>def aperson
    File.open("people/Elvis Presley.json") do |f|
      parse = JSON.parse(f.read) 
    end
  end
  </code></pre>
  
  <p>Non-working method to iterate through a directory:</p>
  
  <pre><code>16. def list
  17.   Dir.glob('people/*').each do |f|
  18.     parse = JSON.parse(f) 
  19    end
  20. end
  </code></pre>
  
  <p>My error is:</p>
  
  <pre><code>/Users/ad/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/json/common.rb:148:in `parse': 743: unexpected token at 'people/Elvis Presley.json' (JSON::ParserError)
      from /Users/ad/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/json/common.rb:148:in `parse'
      from app.rb:18:in `block in list'
      from app.rb:17:in `each'
      from app.rb:17:in `list'
      from app.rb:24:in `&lt;main&gt;'
  </code></pre>
  
  <p>All of the files in the directory have the same content and are valis as per JSONlint.</p>
  
  <p>Any help would be greatly appreciated.</p>