[英]How to convert dynamo items from scan to dict/json?
I am using boto to retrieve dynamo Items from a scan. 我正在使用boto从扫描中检索发电机项目。
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? 如何将每个项目转换为json对象或字典? 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))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.