简体   繁体   中英

How to convert dynamo items from scan to dict/json?

I am using boto to retrieve dynamo Items from a scan.

for item in scan_results:
    print item

I can access each property with:

for item in scan_results:
    print item['propA']

for item in scan_results:
    print json.dumps(item) # This does not work

How do I convert each item to a json object or a dict? I want to avoid having to iterate over the keys in item and generating a dict through loops if i can avoid it.

这个怎么样?

for item in scan_results: print json.dumps(dict(item))

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