Filter expression with equals with root reference

Setup

Selector: $.items[?(@.key==$.value)]

{"value": 42, "items": [{"key": 10}, {"key": 42}, {"key": 50}]}

Results

Other responses

Bash (JSONPath.sh)

[]

C (json-glib)

Not supported

Unable to compile selector `$.items[?(@.key==$.value)]': Invalid array index definition “?(@.key==$.value)]”

Clojure (json-path) ¹

[
  {
    "key": 42
  }
]

Cpp (jsoncons)

[
  {
    "key": 42
  }
]

Dart (json_path)

Not supported

FormatException: end of input expected at 1:8. Expression: $.items[?(@.key==$.value)]

Elixir (ExJsonPath)

Not supported

syntax error before: '$'

Elixir (jaxon)

[]

Elixir (warpath) ¹

Not supported

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

Erlang (ejsonpath)

[
  {
    "key": 42
  }
]

Golang (github.com-AsaiYusuke-jsonpath) ²

[
  {
    "key": 42
  }
]

Golang (github.com-PaesslerAG-jsonpath) ¹

[
  {
    "key": 42
  }
]

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

[
  {
    "key": 42
  }
]

Golang (github.com-ohler55-ojg)

[]

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-spyzhov-ajson)

[
  {
    "key": 42
  }
]

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

[
  {
    "key": 42
  }
]

Haskell (jsonpath)

[
  {
    "key": 42
  }
]

JavaScript (Goessner) ²

[
  {
    "key": 42
  }
]

JavaScript (brunerd)

[
  {
    "key": 42
  }
]

JavaScript (jsonpath)

[]

Java (com.github.jsurfer)

Not supported

line 1:17 no viable alternative at input '@.key==$'
org.antlr.v4.runtime.misc.ParseCancellationException

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "key": 42
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=8

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "key": 42
  }
]

PHP (galbar-jsonpath) ²

[
  {
    "key": 42
  }
]

PHP (remorhaz-jsonpath)

[]

PHP (softcreatr-jsonpath)

[]

Python (jsonpath) ²

Not found

jsonpath returned false, this might indicate an error

Python (jsonpath-ng)

Not supported

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

Python (jsonpath-rw)

Not supported

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

Python (jsonpath2)

Not supported

line 1:16 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}
ValueError("line 1:16 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}")

Raku (JSON-Path)

Not supported

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

Ruby (jsonpath)

[]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

[
  {
    "key": 42
  }
]

Rust (jsonpath_plus)

[
  {
    "key": 42
  }
]

Scala (jsonpath)

[
  {
    "key": 42
  }
]

Swift (Sextant)

[
  {
    "key": 42
  }
]

dotNET (Json.NET)

[
  {
    "key": 42
  }
]

dotNET (JsonCons.JsonPath)

[
  {
    "key": 42
  }
]

dotNET (JsonPath.Net)

[
  {
    "key": 42
  }
]

dotNET (Manatee.Json)

[
  {
    "key": 42
  }
]

JSON (Path_Reference_Implementation)

Not supported

 --> 1:9
  |
1 | $.items[?(@.key==$.value)]
  |         ^---
  |
  = expected unionChild, unionArrayIndex, or sliceStart

Proposal (A)

[
  {
    "key": 42
  }
]

Errors

JavaScript (jsonpath-plus)

jsonPath: $ is not defined: @.key==$.value

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

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

dotNET (JsonPathLib)

$ is not defined

Footnotes