Filter expression with different ungrouped operators

Setup

Selector: $[?(@.a && @.b || @.c)]

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "a": true
  },
  {
    "b": true
  },
  {
    "c": true
  },
  {
    "d": true
  },
  {}
]

Results

Other responses

Bash (JSONPath.sh)

[
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true
]

C (json-glib)

Not supported

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

Clojure (json-path) ¹

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  }
]

Cpp (jsoncons)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

Dart (json_path)

Not supported

FormatException: end of input expected at 1:2. Expression: $[?(@.a && @.b || @.c)]

Elixir (ExJsonPath)

Not supported

illegal characters "&"

Elixir (jaxon)

[]

Elixir (warpath) ¹

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

Golang (github.com-PaesslerAG-jsonpath) ¹

Not supported

parsing error: $[?(@.a && @.b || @.c)]	 - 1:11 unknown operator &&

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

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

Golang (github.com-ohler55-ojg)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

Golang (github.com-spyzhov-ajson)

[
  {
    "a": true,
    "b": true,
    "c": true
  }
]

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

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

Haskell (jsonpath)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

JavaScript (Goessner) ²

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

JavaScript (brunerd)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

JavaScript (jsonpath)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

JavaScript (jsonpath-plus)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

Java (com.github.jsurfer)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

PHP (galbar-jsonpath) ²

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

PHP (remorhaz-jsonpath)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

Python (jsonpath) ²

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  }
]

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:8 token recognition error at: '&'
ValueError("line 1:8 token recognition error at: '&'")

Raku (JSON-Path)

Not supported

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

Ruby (jsonpath)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "c": true
  }
]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  }
]

Rust (jsonpath_plus)

[
  {
    "a": true,
    "b": true,
    "c": true
  }
]

Scala (jsonpath)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

Swift (Sextant)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

dotNET (Json.NET)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  }
]

dotNET (JsonCons.JsonPath)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

dotNET (JsonPath.Net)

[
  {
    "a": true,
    "b": true,
    "c": true
  }
]

dotNET (JsonPathLib)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

dotNET (Manatee.Json)

[
  {
    "a": true,
    "b": true
  },
  {
    "a": true,
    "b": true,
    "c": true
  },
  {
    "b": true,
    "c": true
  },
  {
    "a": true,
    "c": true
  },
  {
    "c": true
  }
]

JSON (Path_Reference_Implementation)

Not supported

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

Proposal (A)

Not supported


x 1:16-1:16 ComparisonOperator
| $[?(@.a && @.b || @.c)]
|                ^
o 1:12-1:15 HigherPrecedenceFilterExpression
| $[?(@.a && @.b || @.c)]
|            ^^^
x 1:12-1:12 LogicalAnd
| $[?(@.a && @.b || @.c)]
|            ^
| x 1:16-1:16 ComparisonOperator
| | $[?(@.a && @.b || @.c)]
| |                ^
| o 1:12-1:15 HigherPrecedenceFilterExpression
| | $[?(@.a && @.b || @.c)]
| |            ^^^
| | 
|/  
o 1:5-1:15 LogicalAnd
| $[?(@.a && @.b || @.c)]
|     ^^^^^^^^^^
o 1:5-1:15 FilterExpression
| $[?(@.a && @.b || @.c)]
|     ^^^^^^^^^^
x 1:3-1:3 BracketElement
| $[?(@.a && @.b || @.c)]
|   ^
x 1:3-1:3 BracketElements
| $[?(@.a && @.b || @.c)]
|   ^
x 1:2-1:2 BracketChildren
| $[?(@.a && @.b || @.c)]
|  ^
x 1:2-1:2 Operator
| $[?(@.a && @.b || @.c)]
|  ^
o 1:1-1:2 Start
  $[?(@.a && @.b || @.c)]
  ^

Errors

Erlang (ejsonpath)

Timeout

Golang (github.com-oliveagle-jsonpath) ¹

invalid char at 10: ` `

PHP (Goessner) ²

ArgumentCountError

PHP (softcreatr-jsonpath)

Error: 'Malformed filter query'

Perl (JSON-Path)

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

Footnotes