title: How can I extract a Summoner Name from a JSON response?
body: <p>I'm playing around with with external APIs from <em>League of Legends</em>. So far, I've been able to get a response from the API, which returns a JSON object.</p>
  
  <pre><code> @test_summoner_name = ERB::Util.url_encode('Jimbo')
   @url = "https://na.api.pvp.net/api/lol/na/v1.4/summoner/by-name/#{@test_summoner_name}?api_key=#{RIOT_API_KEY}"
   response = HTTParty.get(@url)
   @summoner = JSON.parse(response.body)
   @summoner_name = @summoner[:name]
  </code></pre>
  
  <p>The JSON object looks like this:</p>
  
  <blockquote>
    <p>{"jimbo"=>{"id"=>12345678, "name"=>"Jimbo", "profileIconId"=>1234, "revisionDate"=>123456789012, "summonerLevel"=>10}}</p>
  </blockquote>
  
  <p>So, I'm able to output the JSON object with my <em>@summoner</em> variable in my view. But when I try to output my <em>@summoner_name</em> variable, I just get a blank string.</p>
  
  <p>For reference, this is my view currently:</p>
  
  <pre><code>Summoner Object: &lt;%= @summoner %&gt;&lt;br&gt;
  
  Summoner Name: &lt;%= @summoner_name %&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated. I've been stumbling through this process all day now.</p>