I'm trying to take a json response and create as many objects that are contained in the response. Based on the text below, I want variable to be based on "testuser1" and the next variable to be based on "testuser2", and so on. Im able to convert the response to a dictionary but I'm sure how to count the objects and make variables out of each so I can refer and change them later in the code.
{'Accounts':
[
{'Name': 'testuser1',
'Username': 'testuser1',
'Email': '[email protected]'},
{'Name': 'testuser2',
'Username': 'testuser2',
'Email': '[email protected]'}
]
Basically, I want to count and create as many objects that are in the response. I don't want to use the split function to look for the {}. For example: $var1 = {'Name': 'testuser1', 'Username': 'testuser2=1', 'Email': '[email protected]'} and $var2 = {'Name': 'testuser2', 'Username': 'testuser2', 'Email': '[email protected]'}