【发布时间】:2016-04-17 23:25:37
【问题描述】:
我有一个包含多个这样的 json 字符串的列表
a = [{"name": "Alex"},{"Age": 25},{"Address": "16, Mount View"}]
我想像这样将它们合并到一个数组中
a = [{"name": "Alex","Age": 25,"Address": "16, Mount View"}]
我曾尝试使用 jsonmerge,但在使用 head' andbase` 值时它无法正常工作。
谁能帮帮我。
我在堆栈中也遇到了类似的问题,但它显示了单独的 json 合并,而不是列表中的 json How to merge two json
【问题讨论】:
-
这与 JSON 无关,因为此时您只有一个 Python 字典对象列表。关于如何将字典列表合并在一起已经有很多答案,例如the answers to this SO question.