简体   繁体   中英

Python, list dicts to json

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM