I am sending a JSON string from Objective-C to Python. Then I want to break contents of the string into a Python list. I am trying to iterate over a string (any string for now):
for python 3.6 above, there has a little difference
s = '[{"i":"imap.gmail.com","p":"someP@ss"},{"i":"imap.aol.com","p":"anoterPass"}]'
jdata = json.loads(s)
print (jdata)
for d in jdata:
for key, value in d.items():
print (key, value)
[{'i': 'imap.gmail.com', 'p': 'someP@ss'}, {'i': 'imap.aol.com', 'p': 'anoterPass'}]
i imap.gmail.com
p someP@ss
i imap.aol.com
p anoterPass