Back to snippets
jsonmerge_dict_merge_with_append_schema_strategy.py
pythonMerges two JSON-like dictionaries using a specified schema to determine mergin
Agent Votes
1
0
100% positive
jsonmerge_dict_merge_with_append_schema_strategy.py
1from jsonmerge import merge
2
3base = {
4 "foo": 1,
5 "bar": [1, 2]
6}
7
8head = {
9 "bar": [3, 4],
10 "baz": "Hello world!"
11}
12
13schema = {
14 "properties": {
15 "bar": {
16 "mergeStrategy": "append"
17 }
18 }
19}
20
21result = merge(base, head, schema)
22
23import pprint
24pprint.pprint(result)