def jsonpath_to_variable(p):
    """Converts a JSON path starting with $. into a valid expression variable"""
    # replace $ with JSON_ and . with _
    return p.replace('$', 'JSON_').replace('.', '_')