{"record":{"id":"55703e67f3012058","repo":"json-path/JsonPath","slug":"filter-operator-is-not-supported","errorCode":null,"errorMessage":"Filter operator  is not supported!","messagePattern":"Filter operator  is not supported!","errorType":"exception","errorClass":"InvalidPathException","httpStatus":null,"severity":"error","filePath":"json-path/src/main/java/com/jayway/jsonpath/internal/filter/RelationalOperator.java","lineNumber":52,"sourceCode":"    EMPTY(\"EMPTY\"),\n    SUBSETOF(\"SUBSETOF\"),\n    ANYOF(\"ANYOF\"),\n    NONEOF(\"NONEOF\");\n\n    private final String operatorString;\n\n    RelationalOperator(String operatorString) {\n        this.operatorString = operatorString;\n    }\n\n    public static RelationalOperator fromString(String operatorString) {\n        String upperCaseOperatorString = operatorString.toUpperCase(Locale.ROOT);\n        for (RelationalOperator operator : RelationalOperator.values()) {\n            if(operator.operatorString.equals(upperCaseOperatorString) ){\n                return operator;\n            }\n        }\n        throw new InvalidPathException(\"Filter operator \" + operatorString + \" is not supported!\");\n    }\n\n    @Override\n    public String toString() {\n        return operatorString;\n    }\n}\n","sourceCodeStart":34,"sourceCodeEnd":60,"githubUrl":"https://github.com/json-path/JsonPath/blob/62a4c9f0f65ba3f625aa0867d64c528ba72d09ec/json-path/src/main/java/com/jayway/jsonpath/internal/filter/RelationalOperator.java#L34-L60","documentation":"RelationalOperator.fromString() uppercases the given token and looks for a matching RelationalOperator enum (e.g. ==, !=, <, >, =~, IN, NIN, SIZE, EMPTY). If no enum constant's operatorString equals it, the library throws InvalidPathException stating the filter operator is not supported. The lookup is case-insensitive, so the token must still be a known operator after uppercasing.","triggerScenarios":"Calling JsonPath.read/parse with a filter predicate using a comparison operator not in RelationalOperator (e.g. \"===\", \"=<\", \">>\", or a locale-specific symbol) — the uppercase form of the token matches no enum constant.","commonSituations":"Filters ported from other JSONPath engines or SQL/JS habits (\"===\", \"!==\"); regex comparisons written as \"~~\" instead of \"=~\"; typos like \"=<\"; expressions generated by tooling that emits a non-Jayway operator set.","solutions":["Use only supported operators: == != < <= > >= =~ in / nin / size / empty (case-insensitive for the word operators).","Check the message text for the exact unsupported token and correct the spelling (e.g. \"=~\" for regex match, not \"~~\").","Replace JavaScript-style strict equality (\"===\") with \"==\".","Validate filter expressions at load time in a test so invalid operators fail fast before runtime evaluation."],"exampleFix":"// before\nString jsonPath = \"$[?(@.name === 'foo')]\";\nJsonPath.read(json, jsonPath);\n\n// after\nString jsonPath = \"$[?(@.name == 'foo')]\";\nJsonPath.read(json, jsonPath);","handlingStrategy":"validation","validationCode":"// Java: check each predicate operator against the supported set before evaluating\nstatic final java.util.Set<String> SUPPORTED = java.util.Set.of(\n    \"==\",\"!=\",\"<\",\"<=\",\">\",\">=\",\"=~\",\"IN\",\"NIN\",\"SIZE\",\"EMPTY\",\"ALL\",\"ANY\",\"NONE\",\"MATCHES\");\nvoid validateOperators(String filter) {\n    for (String tok : filter.split(\"\\\\s+\")) {\n        if (!SUPPORTED.contains(tok.toUpperCase(java.util.Locale.ROOT)) && !tok.matches(\"[@$.(].*\") && !tok.startsWith(\"&&\") && !tok.startsWith(\"||\")) {\n            // log/inspect suspicious tokens; cheaper than a runtime parse failure\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    return JsonPath.read(json, path);\n} catch (InvalidPathException e) {\n    if (e.getMessage().contains(\"is not supported!\")) {\n        throw new IllegalArgumentException(\"Unsupported filter operator in: \" + path, e);\n    }\n    throw e;\n}","preventionTips":["Memorize the supported set: == != < <= > >= =~ in nin size empty (word operators case-insensitive).","Never use JS-style === or !==; Jayway only has ==.","Use =~ for regex matching, not ~~.","Parse all configured paths once at boot in a fail-fast test."],"tags":["json-path","filter-syntax","operator-parsing","invalid-path"],"backgroundTag":"unsupported-enum-value","analyzedSha":"62a4c9f0f65ba3f625aa0867d64c528ba72d09ec","analyzedAt":"2026-09-11T11:36:00.448Z","contentChangedAt":"2026-09-11T11:36:00.448Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}