Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
591 B
5
Indexable
Never
import json

def merge_child_details(search_results) -> dict:
    merged_details = []
    for item in search_results.hits:
        details = item.child_subsidiary_details
        data = json.loads(details)

        # Merging the keys into a single dictionary for demonstration
        merged_keys_string = ", ".join([f'"key": "{item["key"]}", "name": "{item["name"]}"' for item in data])

        # Output the merged keys in the desired format as a string
        merged_keys_output = f'{{ {merged_keys_string} }}'
        merged_details.append(merged_keys_output)
    return merged_details
Leave a Comment