title: How to avoid "undefined method `[]' for nil:NilClass" when working with nested Ruby hashes?
body: <p>I'm working with the Steam Storefront API - <a href="http://store.steampowered.com/api/appdetails/?appids=240" rel="nofollow">http://store.steampowered.com/api/appdetails/?appids=240</a></p>
  
  <p>I've parsed the JSON into a hash.</p>
  
  <p>When I try to select any hash value nested inside of "data" I receive an "undefined method `[]' for nil:NilClass" error.</p>
  
  <p>I can <code>puts</code> the whole lot with <code>res["240"]["data"]</code> which shows me all of the keys and values. All of which seem to look fine.</p>
  
  <p>However when I try to go one branch further it throws nil.</p>
  
  <pre><code>res["240"]["data"]["type"]
  </code></pre>
  
  <p>Using <code>.key</code> also throws up an error.</p>
  
  <pre><code>res["240"]["data"].key
  </code></pre>
  
  <p>My quest to find an answer has mainly found suggestions of searching for the key &amp; values, however I know the direct route to the data so I'd like to go this route if possible.</p>
  
  <p>Thanks.</p>