import json


def merge_json_data(old_data: str, new_data: str) -> str:
    """Merge to dictionaries encoded as JSON."""
    if not old_data:
        return new_data

    data = json.loads(old_data)
    data.update(json.loads(new_data))
    return json.dumps(data)