title: Ruby puts key instead of value from a json file
body: <p>I have a problem with ruby and json. 
  I have a json-file with information scraped from the internet. For the following problem I'll use a hardcoded file, which has the following syntax:</p>
  
  <pre><code>[{
    "day": "20120827_234558",
    "entries": [
      {
        "rank": "3",
        "club": "SuS Schalke 1896 e.V.",
        "votes": "126"
      },
      {
        "rank": "4",
        "club": "TuS Hamborn-Neumühl 07 e.V.",
        "votes": "120"
      }
  ]
  },{
    "day": "20120827_234700",
    "entries": [
      {
        "rank": "1",
        "club": "TLV Germania 1901 Essen-Überruhr",
        "votes": "210"
      },
      {
        "rank": "2",
        "club": "Rumelner TV",
        "votes": "141"
      }
  ]
  }]
  </code></pre>
  
  <p>I wrote then a ruby script which loads the json from the file and puts it into a hash,
  fetches some information from the internet (as well hard coded in this example), adds these new information to the hash, converts the hash to json and stores it in the file again.</p>
  
  <pre><code>require 'rubygems'
  require 'open-uri'
  require 'json'
  
  fname = 'ranking.json'
  
  json = JSON.load(File.open(fname))
  
  json.each do |ranking|
    puts 'entry:'
    puts ranking['day']
  end
  
  puts "\n";
  
  new_data = Array.new
  new_data = { "day" =&gt; "20120828_234558", "entries" =&gt; "sgankhask" }
  json &lt;&lt; new_data.to_json
  
  json.each do |ranking|
    puts 'entry:'
    puts ranking['day']
  end
  </code></pre>
  
  <p>So it's all about simply appending data in json format to an already existing json. </p>
  
  <p>But if I execute this script, I get the following output:</p>
  
  <pre class="lang-none prettyprint-override"><code>entry:
  20120827_234558
  entry:
  20120827_234700
  
  entry:
  20120827_234558
  entry:
  20120827_234700
  entry:
  day
  </code></pre>
  
  <p>I'm confused about the last row. I assumed the last row to be <code>entry: 20120828_234558</code>.
  It seems, that Ruby takes the key ('day') of the hash instead of the value ('20120828_234558')?</p>
  
  <p>What is wrong in my script? Any help is appreciated.</p>