title: Extract and format Values from nested json data
body: <p>I am trying to extract some data from the json data frame below, using Python 2.7.9.</p>
  
  <p>I am trying to get to the counts in a single row that are listed inside the "steps" list using the code below: </p>
  
  <pre><code>data2 = (json.loads(data));
  
  for data_key,data_value in data2['data'].items():
  for date_key,date_value in data_value.items():
      for steps_value in date_value:
          if 'steps' == date_key:    #looping on dictionary object
              print data_key,steps_value['count'],steps_value['event'],steps_value['custom_event']
  </code></pre>
  
  <p>On digging further, I managed to make some progress and get to the values. I am not a Python expert, so wondering if this could be done in a more elegant manner.Still looking to get to the output as below. </p>
  
  <p>Ideal Output format:<br>
  Date1 Step1 Count1 Step2 Count2<br>
  Date2 Step2 Count1 Step2 Count2</p>
  
  <p>Sample Data frame:</p>
  
  <pre><code>"frame": 
  {"dates": ["2016-09-12", "2016-09-19", "2016-09-26"]}, 
  "data": {
      "2016-09-12": 
          {"steps": [
              {"count": 325788, "step_conv_ratio": 1, "goal": "App Open", "overall_conv_ratio": 1, "avg_time": null, "event": "App Open"}, 
              {"count": 20524, "step_conv_ratio": 0.627875673029858, "goal": "Game Played", 
              "avg_time": 572, "event": "Game Played"}], 
          "analysis": {"completion": 20524, "starting_amount": 32688, "steps": 2, "worst": 1}}, 
      "2016-09-19": 
          {"steps": [
              {"count": 32186, "step_conv_ratio": 1, "goal": "App Open", "overall_conv_ratio": 1, "avg_time": null, "event": "App Open"}, 
              {"count": 20809, "step_conv_ratio": 0.6405528535369082, "goal": "Game Played", 
              "avg_time": 698, "event": "Game Played"}], 
          "analysis": {"completion": 20809, "starting_amount": 32486, "steps": 2, "worst": 1}}, 
      "2016-09-26": 
          {"steps": [
              {"count": 456, "step_conv_ratio": 1, "goal": "App Open", "overall_conv_ratio": 1, "avg_time": null, "event": "App Open"}, 
              {"count": 587, "step_conv_ratio": 0.7873688132646091, "goal": "Game Played", 
              "avg_time": 571, "event": "Game Played"}], 
          "analysis": {"completion": 12679, "starting_amount": 16103, "steps": 2, "worst": 1}}
      }} 
  </code></pre>
  
  <p>Any help / suggestions would be appreciated.</p>
  
  <p>Thanks</p>