title: Parsing Json with multiple "levels" with Python
body: <p>I'm trying to parse a json file from an api call.</p>
  
  <p>I have found this code that fits my need and trying to adapt it to what I want:</p>
  
  <pre><code>import math, urllib2, json, re
  
  
  def download():
      graph = {}
      page = urllib2.urlopen("http://fx.priceonomics.com/v1/rates/?q=1")
      jsrates = json.loads(page.read())
  
      pattern = re.compile("([A-Z]{3})_([A-Z]{3})")
      for key in jsrates:
          matches = pattern.match(key)
          conversion_rate = -math.log(float(jsrates[key]))
          from_rate = matches.group(1).encode('ascii','ignore')
          to_rate = matches.group(2).encode('ascii','ignore')
          if from_rate != to_rate:
              if from_rate not in graph:
                  graph[from_rate] = {}
              graph[from_rate][to_rate] = float(conversion_rate)
      return graph
  </code></pre>
  
  <p>And I've turned it into:</p>
  
  <pre><code>import math, urllib2, json, re
  
  
  def download():
      graph = {}
      page = urllib2.urlopen("https://bittrex.com/api/v1.1/public/getmarketsummaries")
      jsrates = json.loads(page.read())
  
      for pattern in jsrates['result'][0]['MarketName']:
      for key in jsrates['result'][0]['Ask']:
          matches = pattern.match(key)
          conversion_rate = -math.log(float(jsrates[key]))
          from_rate = matches.group(1).encode('ascii','ignore')
          to_rate = matches.group(2).encode('ascii','ignore')
          if from_rate != to_rate:
              if from_rate not in graph:
                  graph[from_rate] = {}
              graph[from_rate][to_rate] = float(conversion_rate)
      return graph
  </code></pre>
  
  <p>Now the problem is that there is multiple level in the json "Result > 0, 1,2 etc"</p>
  
  <p><a href="https://i.stack.imgur.com/68rcp.png" rel="nofollow noreferrer">json screenshot</a></p>
  
  <pre><code>for key in jsrates['result'][0]['Ask']:
  </code></pre>
  
  <p>I want the zero to be able to be any number, I don't know if thats clear.
  So I could get all the ask price to match their marketname.</p>
  
  <p>I have shortened the code so it doesnt make too long of a post.</p>
  
  <p>Thanks
  PS: sorry for the english, its not my native language.</p>