Python, list dicts to json

3.7k Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

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.