Filter expression with equals array

Setup

Selector: $[?(@.d==["v1","v2"])]

[
  {
    "d": [
      "v1",
      "v2"
    ]
  },
  {
    "d": [
      "a",
      "b"
    ]
  },
  {
    "d": "v1"
  },
  {
    "d": "v2"
  },
  {
    "d": {}
  },
  {
    "d": []
  },
  {
    "d": null
  },
  {
    "d": -1
  },
  {
    "d": 0
  },
  {
    "d": 1
  },
  {
    "d": "['v1','v2']"
  },
  {
    "d": "['v1', 'v2']"
  },
  {
    "d": "v1,v2"
  },
  {
    "d": "[\"v1\", \"v2\"]"
  },
  {
    "d": "[\"v1\",\"v2\"]"
  }
]

Results

Other responses

Bash (JSONPath.sh)

[]

C (json-glib)

Not supported

Unable to compile selector `$[?(@.d==["v1","v2"])]': Invalid array index definition “?(@.d==["v1","v2"])]”

Cpp (jsoncons)

[
  {
    "d": [
      "v1",
      "v2"
    ]
  }
]

Dart (json_path)

Not supported

FormatException: end of input expected at 1:2. Expression: $[?(@.d==["v1","v2"])]

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)

Not supported

syntax error before: '['

Golang (github.com-PaesslerAG-jsonpath) ¹

Not supported

parsing error: $[?(@.d==["v1","v2"])]	:1:10 - 1:11 unexpected "[" while scanning extensions

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

Not supported

invalid filter term at position 9, following "=="

Haskell (jsonpath)

Not supported

Invalid JSONPath: $[?(@.d==["v1","v2"])]
 Error: 1:10:
  |
1 | $[?(@.d==["v1","v2"])]
  |          ^^^^^
unexpected "["v1""
expecting "false", "null", "true", '!', '"', '$', ''', '@', digit, or white space

JavaScript (Goessner) ²

[
  {
    "d": "v1,v2"
  }
]

JavaScript (brunerd)

[]

JavaScript (jsonpath)

[
  {
    "d": "v1,v2"
  }
]

JavaScript (jsonpath-plus)

[
  {
    "d": "v1,v2"
  }
]

Java (com.github.jsurfer)

Not supported

line 1:9 no viable alternative at input '@.d==['
org.antlr.v4.runtime.misc.ParseCancellationException

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "d": [
      "v1",
      "v2"
    ]
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "d": [
      "v1",
      "v2"
    ]
  }
]

PHP (galbar-jsonpath) ²

Not found

jsonpath returned false, this might indicate an error

PHP (remorhaz-jsonpath)

[
  {
    "d": [
      "v1",
      "v2"
    ]
  }
]

PHP (softcreatr-jsonpath)

[
  {
    "d": [
      "v1",
      "v2"
    ]
  }
]

Python (jsonpath) ²

[
  {
    "d": [
      "v1",
      "v2"
    ]
  }
]

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

Not supported

path error: 
$[?(@.d==["v1","v2"])]
^^^^^^^^^

Scala (jsonpath)

Not supported

JPError(end of input expected)

Swift (Sextant)

[
  {
    "d": [
      "v1",
      "v2"
    ]
  },
  {
    "d": "[\"v1\",\"v2\"]"
  }
]

dotNET (Json.NET)

Not supported

Unexpected character while parsing path query: [

dotNET (JsonCons.JsonPath)

[
  {
    "d": [
      "v1",
      "v2"
    ]
  }
]

dotNET (JsonPath.Net)

[]

dotNET (Manatee.Json)

Not supported

Unrecognized JSON Path Expression element. Path up to error: '$'

JSON (Path_Reference_Implementation)

Not supported

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

Proposal (A)

Not supported


x 1:10-1:10 DocumentValue
| $[?(@.d==["v1","v2"])]
|          ^
| x 1:10-1:10 IntegerPart
| | $[?(@.d==["v1","v2"])]
| |          ^
| x 1:10-1:10 Number
| | $[?(@.d==["v1","v2"])]
| |          ^
| x 1:10-1:10 SimpleValue
| | $[?(@.d==["v1","v2"])]
| |          ^
| | 
|/  
x 1:10-1:10 FilterValue
| $[?(@.d==["v1","v2"])]
|          ^
o 1:5-1:8 HigherPrecedenceFilterExpression
| $[?(@.d==["v1","v2"])]
|     ^^^
x 1:5-1:5 LogicalOr
| $[?(@.d==["v1","v2"])]
|     ^
| x 1:10-1:10 DocumentValue
| | $[?(@.d==["v1","v2"])]
| |          ^
| | x 1:10-1:10 IntegerPart
| | | $[?(@.d==["v1","v2"])]
| | |          ^
| | x 1:10-1:10 Number
| | | $[?(@.d==["v1","v2"])]
| | |          ^
| | x 1:10-1:10 SimpleValue
| | | $[?(@.d==["v1","v2"])]
| | |          ^
| | | 
| |/  
| x 1:10-1:10 FilterValue
| | $[?(@.d==["v1","v2"])]
| |          ^
| o 1:5-1:8 HigherPrecedenceFilterExpression
| | $[?(@.d==["v1","v2"])]
| |     ^^^
| x 1:5-1:5 LogicalAnd
| | $[?(@.d==["v1","v2"])]
| |     ^
| | x 1:10-1:10 DocumentValue
| | | $[?(@.d==["v1","v2"])]
| | |          ^
| | | x 1:10-1:10 IntegerPart
| | | | $[?(@.d==["v1","v2"])]
| | | |          ^
| | | x 1:10-1:10 Number
| | | | $[?(@.d==["v1","v2"])]
| | | |          ^
| | | x 1:10-1:10 SimpleValue
| | | | $[?(@.d==["v1","v2"])]
| | | |          ^
| | | | 
| | |/  
| | x 1:10-1:10 FilterValue
| | | $[?(@.d==["v1","v2"])]
| | |          ^
| | o 1:5-1:8 HigherPrecedenceFilterExpression
| | | $[?(@.d==["v1","v2"])]
| | |     ^^^
| | | 
|/ /  
| | 
|/  
o 1:5-1:8 FilterExpression
| $[?(@.d==["v1","v2"])]
|     ^^^
x 1:3-1:3 BracketElement
| $[?(@.d==["v1","v2"])]
|   ^
x 1:3-1:3 BracketElements
| $[?(@.d==["v1","v2"])]
|   ^
x 1:2-1:2 BracketChildren
| $[?(@.d==["v1","v2"])]
|  ^
x 1:2-1:2 Operator
| $[?(@.d==["v1","v2"])]
|  ^
o 1:1-1:2 Start
  $[?(@.d==["v1","v2"])]
  ^

Errors

Clojure (json-path) ¹

java.lang.Exception object must be an array.

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

unknown token at 5: ["v1","v2"] at 4

Golang (github.com-ohler55-ojg)

Exception: runtime error: comparing uncomparable type []interface {}

Golang (github.com-oliveagle-jsonpath) ¹

interface conversion: interface {} is nil, not string

Golang (github.com-spyzhov-ajson)

wrong request: wrong request: ?(@.d==["v1","v2"])

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

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

Rust (jsonpath_plus)

Error Parsing JSON Path:
$[?(@.d==["v1","v2"])]
panic occurred

dotNET (JsonPathLib)

Object reference not set to an instance of an object.

Footnotes