Filter expression with equals on object

Setup

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

{
    "a": {"key": 0},
    "b": {"key": 42},
    "c": {"key": -1},
    "d": {"key": 41},
    "e": {"key": 43},
    "f": {"key": 42.0001},
    "g": {"key": 41.9999},
    "h": {"key": 100},
    "i": {"some": "value"}
}

Results

Other responses

Bash (JSONPath.sh)

[]

C (json-glib)

Not supported

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

Clojure (json-path) ¹

[
  {
    "some": "value"
  }
]

Cpp (jsoncons)

[
  {
    "key": 42
  }
]

Dart (json_path)

[
  {
    "key": 42
  }
]

Elixir (ExJsonPath)

[
  {
    "key": 42
  }
]

Elixir (jaxon)

[]

Elixir (warpath) ¹

[]

Erlang (ejsonpath)

[
  {
    "key": 42
  }
]

Golang (github.com-PaesslerAG-jsonpath) ¹

[
  {
    "key": 42
  }
]

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

[]

Golang (github.com-ohler55-ojg)

[
  {
    "key": 42
  }
]

Golang (github.com-spyzhov-ajson)

[
  {
    "key": 42
  }
]

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

[]

Haskell (jsonpath)

[
  {
    "key": 42
  }
]

JavaScript (Goessner) ²

Not found

jsonpath returned false, this might indicate an error

JavaScript (brunerd)

[]

JavaScript (jsonpath)

[
  {
    "key": 42
  }
]

JavaScript (jsonpath-plus)

[
  {
    "key": 42
  }
]

JavaScript (jsonpathly)

[]

Java (com.github.jsurfer)

[
  {
    "key": 42
  }
]

Java (com.jayway.jsonpath) ¹ ³

[]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[]

PHP (galbar-jsonpath)

[
  {
    "key": 42
  }
]

PHP (remorhaz-jsonpath)

[]

PHP (softcreatr-jsonpath)

[
  {
    "key": 42
  }
]

Python (jsonpath) ²

[
  {
    "key": 42
  }
]

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:10 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}
ValueError("line 1:10 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}")

Python (python-jsonpath)

[
  {
    "key": 42
  }
]

Raku (JSON-Path)

Not supported

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

Ruby (jsonpath)

[]

Rust (jsonpath)

[]

Rust (jsonpath_lib)

[]

Rust (jsonpath_plus)

[
  {
    "key": 42
  }
]

Rust (serde_json_path)

[
  {
    "key": 42
  }
]

Scala (jsonpath)

[]

Swift (Sextant)

[]

dotNET (Json.NET)

[]

dotNET (JsonCons.JsonPath)

[
  {
    "key": 42
  }
]

dotNET (JsonPath.Net)

[
  {
    "key": 42
  }
]

dotNET (JsonPathLib)

[
  {
    "key": 42
  }
]

dotNET (Manatee.Json)

[
  {
    "key": 42
  }
]

Errors

Golang (github.com-oliveagle-jsonpath) ¹

key error:  not found in object

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

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

Footnotes