Filter expression with in current object

Setup

Selector: $[?(2 in @.d)]

[{"d": [1, 2, 3]}, {"d": [2]}, {"d": [1]}, {"d": [3, 4]}, {"d": [4, 2]}]

Results

Other responses

Bash (JSONPath.sh)

[]

C (json-glib)

Not supported

Unable to compile selector `$[?(2 in @.d)]': Invalid array index definition “?(2 in @.d)]”

Clojure (json-path) ¹

[]

Cpp (jsoncons)

Not supported

Expected dot or left bracket separator at line 1 and column 7

Dart (json_path)

Not supported

Instance of 'ParserException': end of input expected (at 1:2)

Elixir (ExJsonPath)

Not supported

syntax error before: 2

Elixir (jaxon)

[]

Elixir (warpath) ¹

Not supported

Parser error: Invalid token on line 1, syntax error before: <<"@">>

Erlang (ejsonpath)

Not supported

syntax error before: <<"in">>

Golang (github.com-PaesslerAG-jsonpath) ¹

Not supported

parsing error: $[?(2 in @.d)]	:1:7 - 1:9 unexpected Ident while scanning parentheses expected ")"

Golang (github.com-ohler55-ojg)

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-vmware-labs-yaml-jsonpath)

Not supported

invalid filter expression at position 6, following "2 "

Haskell (jsonpath)

Not supported

Invalid JSONPath: $[?(2 in @.d)]
 Error: 1:7:
  |
1 | $[?(2 in @.d)]
  |       ^^
unexpected "in"
expecting "!=", "<=", "==", ">=", '!', '<', '>', or white space

JavaScript (Goessner) ²

[
  {
    "d": [
      1,
      2,
      3
    ]
  }
]

JavaScript (brunerd)

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      1
    ]
  },
  {
    "d": [
      3,
      4
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

JavaScript (jsonpath)

[]

JavaScript (jsonpath-plus)

[
  {
    "d": [
      1,
      2,
      3
    ]
  }
]

JavaScript (jsonpathly)

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

Java (com.github.jsurfer)

Not supported

line 1:4 no viable alternative at input '2'
org.antlr.v4.runtime.misc.ParseCancellationException

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

PHP (galbar-jsonpath)

[]

PHP (remorhaz-jsonpath)

Not supported

Error: 'Failed to build AST from JSONPath query: $[?(2 in @.d)]'

Python (jsonpath) ²

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

Python (jsonpath-ng)

Not supported

JsonPathLexerError('Error on line 1, col 2: Unexpected character: ? ')

Python (jsonpath-rw)

Not supported

JsonPathLexerError('Error on line 1, col 2: Unexpected character: ? ')

Python (jsonpath2)

Not supported

line 1:6 mismatched input 'in' expecting ')'
ValueError("line 1:6 mismatched input 'in' expecting ')'")

Python (python-jsonpath)

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

Raku (JSON-Path)

Not supported

Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)

Ruby (jsonpath)

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      1
    ]
  },
  {
    "d": [
      3,
      4
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

Not supported

path error: 
$[?(2 in @.d)]
^^^^^^

Rust (serde_json_path)

Not supported

at position 4, in long-hand segment, parser error

Scala (jsonpath)

Not supported

JPError(end of input expected)

Swift (Sextant)

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

dotNET (Json.NET)

Not supported

Could not read query operator.

dotNET (JsonCons.JsonPath)

Not supported

Syntax error

dotNET (JsonPath.Net)

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

dotNET (JsonPathLib)

[
  {
    "d": [
      1,
      2,
      3
    ]
  },
  {
    "d": [
      2
    ]
  },
  {
    "d": [
      1
    ]
  },
  {
    "d": [
      3,
      4
    ]
  },
  {
    "d": [
      4,
      2
    ]
  }
]

dotNET (Manatee.Json)

Not supported

Unrecognized JSON Path Expression element. Path up to error: '$'

Errors

Golang (github.com-bhmj-jsonslice) ¹ ³

not enough arguments

Golang (github.com-spyzhov-ajson)

wrong request: wrong request: ?(2 in @.d)

PHP (Goessner) ²

ArgumentCountError

PHP (softcreatr-jsonpath)

Error: 'Malformed filter query'

Perl (JSON-Path)

non-safe evaluation, died at main.pl line 11.

Rust (jsonpath_plus)

Error Parsing JSON Path:
$[?(2 in @.d)]
panic occurred

Footnotes