title: loop through json array and retrieve one attribute, gives errors also
body: <p>i am new to programming in ruby, and i am trying to get the value of <code>json['earning_rate_hr']</code> but i get an error, <code>in '[]': no implicit conversion of String into Integer (TypeError)</code><br>
  i know and i understand the error, however this is not my main question here is   my  file :<br>
  <code>checkingchecker.rb :</code>  </p>
  
  <pre><code>#require_relative '../lib/hackex/net/typhoeus'
  require_relative '../lib/hackex'
  require 'rubygems'
  require 'json'
  
  file = 'accounts1.txt'
  f = File.open file, 'r'
  puts "MADE BY THE PEOPLE, FOR THE PEOPLE #madebylorax"
  puts ""
  puts "--------------------------------------------------------"
  puts ""
  
  while line = f.gets
    line = line.chomp.split(';')
    email, password = line
    puts "logging in as " + email
    HackEx.LoginDo(email, password) do |http, auth_token, user|
      puts "getting info..."
      user = HackEx::Request.Do(http, HackEx::Request.UserInfo(auth_token))['user']
      puts "receieved user info!"
      bank = HackEx::Request.Do(http, HackEx::Request.UserBank(auth_token))['user_bank']
      puts "recieved bank info!"
      json = HackEx::Request.Do(http, HackEx::Request.UserSpam(auth_token))['spam']
      puts "recieved spam info!"
      puts json['earning_rate_hr'] #error line, the error is because this is an array, and it cant be turned into integer, i was wondering if there is a way to use puts on it without trying to make it an integer
      userchecking = bank["checking"]
      checking = userchecking.scan(/.{1,3}/).join(',')
      puts email + " has in Checking: BTC #{checking}"
      puts ""
      puts "--------------------------------------------------------"
      puts ""
      end
  end
  </code></pre>
  
  <p>i tried to do <code>puts json</code>, it puts items like this one :  </p>
  
  <blockquote>
    <p>{"id"=>"9867351", "user_id"=>"289108", "victim_user_id"=>"1512021",
    "victim_ip"=
    "86.60.226.175", "spam_level"=>"50", "earning_rate_hr"=>"24300", "total_earning s"=>"13267800", "started_at"=>"2015-11-01 07:46:59",
    "last_collected_at"=>"2015- 11-24 01:46:59"}</p>
  </blockquote>
  
  <p>what i want to do is select the earning_rate_hr for each one of them and add them together, however i do not have a clue on how to do that, since the error is not fixed and i cant get the value of it<br>
  ps : i tried turning it into a Hash, and i also tried using .first, but .first only shows the firs one, i want to show all of them, thank you</p>