def METHOD_NAME(path, json):
    if not path:
        return None
    if "." not in path:
        return str(json.get(path, "")).strip() or None
    data = json
    for path_part in path.split("."):
        data = data.get(path_part)
        if not data:
            return None
    return data