Filter expression on object

Setup

Selector: $[?(@.key)]

{"key": 42, "another": {"key": 1}}

Results

Other responses

Bash (JSONPath.sh)

[]

C (json-glib)

Not supported

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

Clojure (json-path) ¹

[
  {
    "key": 1
  }
]

Cpp (jsoncons)

[
  {
    "key": 1
  }
]

Dart (json_path)

[
  {
    "key": 1
  }
]

Elixir (ExJsonPath)

Not supported

syntax error before: ')'

Elixir (jaxon)

[]

Elixir (warpath) ¹

[
  {
    "another": {
      "key": 1
    },
    "key": 42
  }
]

Erlang (ejsonpath)

[
  {
    "key": 1
  }
]

Golang (github.com-AsaiYusuke-jsonpath) ²

[
  {
    "key": 1
  }
]

Golang (github.com-PaesslerAG-jsonpath) ¹

[
  {
    "key": 1
  }
]

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

[]

Golang (github.com-ohler55-ojg)

Not supported

Golang (github.com-spyzhov-ajson)

[
  {
    "key": 1
  }
]

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

[
  {
    "another": {
      "key": 1
    },
    "key": 42
  }
]

Haskell (jsonpath)

[
  {
    "key": 1
  }
]

JavaScript (Goessner) ²

[
  42,
  {
    "key": 1
  }
]

JavaScript (brunerd)

[
  42,
  {
    "key": 1
  }
]

JavaScript (jsonpath)

[
  {
    "key": 1
  }
]

JavaScript (jsonpath-plus)

[
  {
    "key": 1
  }
]

Java (com.github.jsurfer)

[
  {
    "key": 1
  }
]

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "another": {
      "key": 1
    },
    "key": 42
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "another": {
      "key": 1
    },
    "key": 42
  }
]

PHP (galbar-jsonpath) ²

[
  {
    "key": 1
  }
]

PHP (remorhaz-jsonpath)

[
  {
    "another": {
      "key": 1
    },
    "key": 42
  }
]

PHP (softcreatr-jsonpath)

[
  {
    "key": 1
  }
]

Python (jsonpath) ²

[
  {
    "key": 1
  }
]

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)

[
  {
    "another": {
      "key": 1
    },
    "key": 42
  }
]

Raku (JSON-Path)

Not supported

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

Ruby (jsonpath)

[
  {
    "another": {
      "key": 1
    },
    "key": 42
  }
]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

[
  {
    "another": {
      "key": 1
    },
    "key": 42
  }
]

Rust (jsonpath_plus)

[]

Scala (jsonpath)

[
  {
    "another": {
      "key": 1
    },
    "key": 42
  }
]

Swift (Sextant)

[
  {
    "another": {
      "key": 1
    },
    "key": 42
  }
]

dotNET (Json.NET)

[]

dotNET (JsonCons.JsonPath)

[
  {
    "key": 1
  }
]

dotNET (JsonPath.Net)

[
  {
    "key": 1
  }
]

dotNET (JsonPathLib)

[
  {
    "key": 1
  }
]

dotNET (Manatee.Json)

[
  {
    "key": 1
  }
]

JSON (Path_Reference_Implementation)

Not supported

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

Proposal (A)

[
  {
    "key": 1
  }
]

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