title: How to solve a JSON parse error: 'no implicit conversion of String into Integrer'?
body: <p>I'm learning the Twitter search API for an ongoing project. I can connect and receive a "200" response. The following code:</p>
  
  <pre><code>require 'rubygems'
  require 'oauth'
  require 'json'
  
  =begin
    __code for oauth and creating response__
  =end
  
  def print_results(tweets)
    tweets.each do |tweet|
      puts tweet
    end
  end
  
  if response.code == '200' then
    tweets = JSON.parse(response.body)
    print_results(tweets)
  end
  </code></pre>
  
  <p>prints this result to the screen:</p>
  
  <pre><code>statuses
  {"metadata"=&gt;{"result_type"=&gt;"recent", "iso_language_code"=&gt;"es"}, "created_at"=&gt;"Mon Dec 02 11:10:53 +0000 2013", "id"=&gt;407466896939044864, "id_str"=&gt;"407466896939044864", "text"=&gt;"Y \"Thérèse\" me recordó sobremanera a \"Madame Bovary\". A mi parecer ambas igual de insulsas.", "source"=&gt;"&lt;a href=\"http://twitter.com/download/android\" rel=\"nofollow\"&gt;Twitter for Android&lt;/a&gt;", "truncated"=&gt;false, "in_reply_to_status_id"=&gt;nil, "in_reply_to_status_id_str"=&gt;nil, "in_reply_to_user_id"=&gt;nil, "in_reply_to_user_id_str"=&gt;nil, "in_reply_to_screen_name"=&gt;nil, "user"=&gt;{"id"=&gt;159480381, "id_str"=&gt;"159480381", "name"=&gt;"our last autumn", "screen_name"=&gt;"RoxyVarlow", "location"=&gt;"Valencia", "description"=&gt;"Perdóname por lo que pueda hacer cuando no te recuerde.", "url"=&gt;"http://t.co/AjyasSdTXb", ......
  </code></pre>
  
  <p>But when I try to parse it with JSON, and extract the text of the twit, either with:</p>
  
  <pre><code>def print_results(tweets)
    tweets.each do |tweet|
      puts tweet['statuses'][0]['text']
    end
  end
  </code></pre>
  
  <p>Or with:</p>
  
  <pre><code>puts tweet['text']
  </code></pre>
  
  <p>I receive an error:</p>
  
  <pre><code>rb:17:in `[]': no implicit conversion of String into Integer (TypeError)
  </code></pre>
  
  <p>What am I doing wrong? How should I extract the text of the tweet from the response?</p>