Python, list dicts to json
-
26-10-2019 - |
سؤال
I have a list of dicts:
for item in list:
listDicts.append(item.AsDict())
How convert listDicts to json string, using simplejson ? Making the list each dictionary will be an object in JSON.
المحلول
Have you tried json.dumps(listDicts)
? It comes out of the box. I'm not sure what simplejson would buy you; in fact, I think they're the same thing.
لا تنتمي إلى StackOverflow