def update_json_with_yaml(json_data, yaml_data):
if isinstance(yaml_data, list):
for index, item in enumerate(yaml_data):
if isinstance(item, dict) and 'key' in item and 'value' in item:
key = item['key']
if key in json_data:
json_data[key] = item['value']
else:
update_json_with_yaml(json_data, item) elif isinstance(yaml_data, dict): for key, value in yaml_data.items(): if isinstance(value, dict): if key in json_data: update_json_with_yaml(json_data[key], value) elif isinstance(value, list): if key in json_data: update_json_with_yaml(json_data[key], value) else:
if key in json_data: json_data[key] = value