Filter expression with non singular existence test

Setup

Selector: $[?(@.a.*)]

[
    {"a": 0},
    {"a": "x"},
    {"a": false},
    {"a": true},
    {"a": null},
    {"a": []},
    {"a": [1]},
    {"a": [1, 2]},
    {"a": {}},
    {"a": {"x": "y"}},
    {"a": {"x": "y", "w": "z"}}
]

Results

Other responses

Bash (JSONPath.sh)

[]

C (json-glib)

Not supported

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

Clojure (json-path) ¹

[]

Cpp (jsoncons)

[
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

Dart (json_path)

Not supported

FormatException: end of input expected at 1:2. Expression: $[?(@.a.*)]

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)

[
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

Golang (github.com-AsaiYusuke-jsonpath) ²

[
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

Golang (github.com-PaesslerAG-jsonpath) ¹

[]

Golang (github.com-ohler55-ojg)

Not supported

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-spyzhov-ajson)

[
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

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

[
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

Haskell (jsonpath)

Not supported

Invalid JSONPath: $[?(@.a.*)]
 Error: 1:9:
  |
1 | $[?(@.a.*)]
  |         ^
unexpected '*'
expecting "!=", "&&", "<=", "==", ">=", "||", '!', ')', '<', '>', or white space

JavaScript (brunerd)

Not supported

Java (com.github.jsurfer)

[
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "a": 0
  },
  {
    "a": "x"
  },
  {
    "a": false
  },
  {
    "a": true
  },
  {
    "a": null
  },
  {
    "a": []
  },
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {}
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "a": 0
  },
  {
    "a": "x"
  },
  {
    "a": false
  },
  {
    "a": true
  },
  {
    "a": null
  },
  {
    "a": []
  },
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {}
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

PHP (galbar-jsonpath) ²

[
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

PHP (remorhaz-jsonpath)

[
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

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 2: Unexpected character: ? ')

Python (jsonpath-rw)

Not supported

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

Python (jsonpath2)

[]

Raku (JSON-Path)

Not supported

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

Ruby (jsonpath)

[
  {
    "a": 0
  },
  {
    "a": "x"
  },
  {
    "a": true
  },
  {
    "a": []
  },
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {}
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

[
  {
    "a": 0
  },
  {
    "a": "x"
  },
  {
    "a": false
  },
  {
    "a": true
  },
  {
    "a": null
  },
  {
    "a": []
  },
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {}
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

Rust (jsonpath_plus)

[]

Scala (jsonpath)

[
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

Swift (Sextant)

[
  {
    "a": 0
  },
  {
    "a": "x"
  },
  {
    "a": false
  },
  {
    "a": true
  },
  {
    "a": null
  },
  {
    "a": []
  },
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {}
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

dotNET (Json.NET)

[
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

dotNET (JsonCons.JsonPath)

[
  {
    "a": [
      1
    ]
  },
  {
    "a": [
      1,
      2
    ]
  },
  {
    "a": {
      "x": "y"
    }
  },
  {
    "a": {
      "w": "z",
      "x": "y"
    }
  }
]

dotNET (JsonPath.Net)

[
  {
    "a": [
      1
    ]
  },
  {
    "a": {
      "x": "y"
    }
  }
]

dotNET (Manatee.Json)

Not supported

The method or operation is not implemented.

JSON (Path_Reference_Implementation)

Not supported

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

Proposal (A)

Not supported


x 1:9-1:9 DotChildName
| $[?(@.a.*)]
|         ^
x 1:8-1:8 ScalarOperator
| $[?(@.a.*)]
|        ^
o 1:5-1:8 DocumentValue
| $[?(@.a.*)]
|     ^^^
o 1:5-1:8 UnaryFilterExpression
| $[?(@.a.*)]
|     ^^^
| x 1:9-1:9 DotChildName
| | $[?(@.a.*)]
| |         ^
| x 1:8-1:8 ScalarOperator
| | $[?(@.a.*)]
| |        ^
| o 1:5-1:8 DocumentValue
| | $[?(@.a.*)]
| |     ^^^
| o 1:5-1:8 FilterValue
| | $[?(@.a.*)]
| |     ^^^
| | 
|/  
o 1:5-1:8 HigherPrecedenceFilterExpression
| $[?(@.a.*)]
|     ^^^
x 1:5-1:5 LogicalOr
| $[?(@.a.*)]
|     ^
| x 1:9-1:9 DotChildName
| | $[?(@.a.*)]
| |         ^
| x 1:8-1:8 ScalarOperator
| | $[?(@.a.*)]
| |        ^
| o 1:5-1:8 DocumentValue
| | $[?(@.a.*)]
| |     ^^^
| o 1:5-1:8 UnaryFilterExpression
| | $[?(@.a.*)]
| |     ^^^
| | x 1:9-1:9 DotChildName
| | | $[?(@.a.*)]
| | |         ^
| | x 1:8-1:8 ScalarOperator
| | | $[?(@.a.*)]
| | |        ^
| | o 1:5-1:8 DocumentValue
| | | $[?(@.a.*)]
| | |     ^^^
| | o 1:5-1:8 FilterValue
| | | $[?(@.a.*)]
| | |     ^^^
| | | 
| |/  
| o 1:5-1:8 HigherPrecedenceFilterExpression
| | $[?(@.a.*)]
| |     ^^^
| x 1:5-1:5 LogicalAnd
| | $[?(@.a.*)]
| |     ^
| | x 1:9-1:9 DotChildName
| | | $[?(@.a.*)]
| | |         ^
| | x 1:8-1:8 ScalarOperator
| | | $[?(@.a.*)]
| | |        ^
| | o 1:5-1:8 DocumentValue
| | | $[?(@.a.*)]
| | |     ^^^
| | o 1:5-1:8 UnaryFilterExpression
| | | $[?(@.a.*)]
| | |     ^^^
| | | x 1:9-1:9 DotChildName
| | | | $[?(@.a.*)]
| | | |         ^
| | | x 1:8-1:8 ScalarOperator
| | | | $[?(@.a.*)]
| | | |        ^
| | | o 1:5-1:8 DocumentValue
| | | | $[?(@.a.*)]
| | | |     ^^^
| | | o 1:5-1:8 FilterValue
| | | | $[?(@.a.*)]
| | | |     ^^^
| | | | 
| | |/  
| | o 1:5-1:8 HigherPrecedenceFilterExpression
| | | $[?(@.a.*)]
| | |     ^^^
| | | 
|/ /  
| | 
|/  
o 1:5-1:8 FilterExpression
| $[?(@.a.*)]
|     ^^^
x 1:3-1:3 BracketElement
| $[?(@.a.*)]
|   ^
x 1:3-1:3 BracketElements
| $[?(@.a.*)]
|   ^
x 1:2-1:2 BracketChildren
| $[?(@.a.*)]
|  ^
x 1:2-1:2 Operator
| $[?(@.a.*)]
|  ^
o 1:1-1:2 Start
  $[?(@.a.*)]
  ^

Errors

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

path: unexpected end of path at 4

JavaScript (Goessner) ²

jsonPath: Unexpected token *: _v.a.*

JavaScript (jsonpath)

Line 1: Unexpected token *

JavaScript (jsonpath-plus)

Unexpected token '*'

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

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

dotNET (JsonPathLib)

Line 1: Unexpected token *

Footnotes