title: How to get all values for a key in the json, not just the last group?
body: <p>The for loop only outputs the marketids for the last set of races of the json file. I think this is because of the if statement preceding the for loop. Anyone know how I can continue looping whilst keeping the if statement?</p>
  <p>My code:</p>
  <pre><code>request1 = requests.get('https://betfair-data-supplier-prod.herokuapp.com/api/daily_racing_results?date=2020-01-02')
  json1 = request1.json()
  marketids = []
  for market in json1:
      if market['raceType'] in ['R']:
          marketids.append(market[&quot;markets&quot;][0][&quot;marketId&quot;])
  print(marketids)
  </code></pre>
  <p>Output of code:</p>
  <pre><code>['166897895', '166892549', '166896013', '166892651', '166892683', '166897912']
  </code></pre>
  <p>Example of json1:</p>
  <pre class="lang-py prettyprint-override"><code>[{'venueName': 'Geelong',
    'raceDay': '2020-01-02 00:00:00',
    'country': 'AUS',
    'raceType': 'R',
    'meetingId': '29637049',
    'markets': [{'marketId': '166897895',
      'raceNo': '1',
      'startTime': '2020-01-02 02:00:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Port Water Bouy Mdn Plate',
      'nzToteEventId': '287012'},
     {'marketId': '166897897',
      'raceNo': '2',
      'startTime': '2020-01-02 02:30:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Portarlington Beach Motel Mdn',
      'nzToteEventId': '287013'},
     {'marketId': '166897899',
      'raceNo': '3',
      'startTime': '2020-01-02 03:00:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Flash Fabrications Mdn Plat3',
      'nzToteEventId': '287014'},
     {'marketId': '166897901',
      'raceNo': '4',
      'startTime': '2020-01-02 03:30:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Race With Empower Racing Mdn',
      'nzToteEventId': '287015'},
     {'marketId': '166897903',
      'raceNo': '5',
      'startTime': '2020-01-02 04:00:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Absolute Landscapes Mdn Plate',
      'nzToteEventId': '287016'},
     {'marketId': '166897905',
      'raceNo': '6',
      'startTime': '2020-01-02 04:30:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Ajk Builders (Bm64)',
      'nzToteEventId': '287017'},
     {'marketId': '166933411',
      'raceNo': '7',
      'startTime': '2020-01-02 05:00:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Batman Mgmt Bellarine Cup-Bm64',
      'nzToteEventId': '287018'},
     {'marketId': '166897909',
      'raceNo': '8',
      'startTime': '2020-01-02 05:30:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Gj Bradding Heating&amp;Cool.-Bm58',
      'nzToteEventId': '287019'},
     {'marketId': '166897911',
      'raceNo': '9',
      'startTime': '2020-01-02 06:00:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Bayshore Electrical (Bm58)',
      'nzToteEventId': '287020'}]},
   {'venueName': 'Mount Barker',
    'raceDay': '2020-01-02 00:00:00',
    'country': 'AUS',
    'raceType': 'R',
    'meetingId': '29636945',
    'markets': [{'marketId': '166892549',
      'raceNo': '1',
      'startTime': '2020-01-02 05:17:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Happy New Year Mdn',
      'nzToteEventId': ''},
     {'marketId': '166892551',
      'raceNo': '2',
      'startTime': '2020-01-02 05:52:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Langton Mdn',
      'nzToteEventId': ''},
     {'marketId': '166892553',
      'raceNo': '3',
      'startTime': '2020-01-02 06:32:00',
      'marketStatus': 'CLOSED',
      'eventName': 'McDonald Hcp (C2)',
      'nzToteEventId': ''},
     {'marketId': '166892555',
      'raceNo': '4',
      'startTime': '2020-01-02 07:10:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Hicks Hcp (C2)',
      'nzToteEventId': ''},
     {'marketId': '166892557',
      'raceNo': '5',
      'startTime': '2020-01-02 07:45:00',
      'marketStatus': 'CLOSED',
      'eventName': 'Lowood (Bm58+)',
      'nzToteEventId': ''}]}]
  </code></pre>