title: Parse JSON to a flat file in Python
body: <p>I would like to read a JSON format file where key is not same always and convert it into a flat file for further processing. I tried find a solution for this, but nothing worked.</p>
  
  <p>Here is the sample JSON data. </p>
  
  <pre><code>{
      "Meta Data": {
          "1. Information": "Intraday (5min) open, high, low, close prices and volume",
          "2. Symbol": "MSFT",
          "3. Last Refreshed": "2019-04-15 13:05:00",
          "4. Interval": "5min",
          "5. Output Size": "Compact",
          "6. Time Zone": "US/Eastern"
      },
      "Time Series (5min)": {
          "2019-04-15 13:05:00": {
              "1. open": "120.8250",
              "2. high": "120.9400",
              "3. low": "120.7800",
              "4. close": "120.9275",
              "5. volume": "152975"
          },
          "2019-04-15 13:00:00": {
              "1. open": "120.8900",
              "2. high": "120.8900",
              "3. low": "120.8000",
              "4. close": "120.8250",
              "5. volume": "156065"
          },
          "2019-04-15 12:55:00": {
              "1. open": "120.8600",
              "2. high": "120.9000",
              "3. low": "120.8450",
              "4. close": "120.8950",
              "5. volume": "53450"
          },
      }
  }       
  </code></pre>
  
  <p>I am trying to convert this to below format</p>
  
  <pre><code>2019-04-15 13:05:00,120.8250,120.9400,120.7800,120.9275,152975
  2019-04-15 13:00:00,120.8900,120.8900,120.8000,120.8250,156065
  2019-04-15 12:55:00,120.8600,120.9000,120.8450,120.8950,53450
  </code></pre>
  
  <p>I tried something like below.</p>
  
  <pre><code>url = URL from where data is coming in JSON format.
  response = requests.get(url, headers=header, cookies=cookies)
  dic = json.loads(response.content)
  len_of_timeseries = len(dic["Time Series (1min)"])
  key_len = {}
  for k in dic["Time Series (1min)"]:
    print (dic["Time Series (1min)"][k])
  f = open(symbolFile,"w") 
  f.write(write the file here)
  f.close
  </code></pre>
  
  <p>Above print statement is print details like below. It's not reading date field at all. </p>
  
  <pre><code>{'1. open': '11689.7998', '2. high': '11690.6504', '3. low': '11689.3496', '4. close': '11689.5996', '5. volume': '0'}
  {'1. open': '11687.2500', '2. high': '11690.2002', '3. low': '11686.6504', '4. close': '11689.3496', '5. volume': '0'}
  </code></pre>
  
  <p>Any help will be appreciated. </p>
  
  <p>Thank you</p>