The problem is that you're iterating over myjson
, the string, not over the result of json.loads(myjson)
, the iterable list.
myjson = json.dumps(testdata)
mydata = json.loads(myjson)
#prints [u'word', u'is', u'bond', False, 6, 99], which contains unicode strings
print mydata
#prints ["word", "is", "bond", false, 6, 99], which is still just a string
print myjson
# Iterates over each character, since it's a string
for i in myjson:
print i
# Iterates over the list
for i in mydata:
print i