I have some JSON data from Airtable that I need to process in Python. I want to create a loop that checks a specific field value and performs different actions based on what it finds.
Here’s an example of the data structure I’m working with:
data_records = [
{'timestamp': '2022-12-15T10:30:45.000Z',
'attributes': {'Updated': '2022-12-16T08:15:20.000Z',
'Employee': 'Sarah',
'Priority': 'High',
'action': 'process'},
'record_id': 'rec1A2B3C4D5E6F7G'},
{'timestamp': '2022-12-15T11:45:30.000Z',
'attributes': {'Updated': '2022-12-16T09:30:15.000Z',
'Employee': 'Michael',
'Priority': 'Medium',
'action': 'process'},
'record_id': 'rec2H3I4J5K6L7M8N'}
]
I need help writing a for loop that will check if the ‘action’ field equals ‘process’ and then execute different code blocks depending on the result. How can I iterate through these records and apply conditional logic based on the field values?