Filter expression with subfilter

Setup

Selector: $[?(@.a[?(@.price>10)])]

[
    {
        "a": [{"price": 1}, {"price": 3}]
    },
    {
        "a": [{"price": 11}]
    },
    {
        "a": [{"price": 8}, {"price": 12}, {"price": 3}]
    },
    {
        "a": []
    }
]

Results

Other responses

Bash (JSONPath.sh)

[]

C (json-glib)

Not supported

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

Clojure (json-path) ¹

[]

Cpp (jsoncons)

[
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  }
]

Dart (json_path)

Not supported

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

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": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  }
]

Golang (github.com-AsaiYusuke-jsonpath) ²

[
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  }
]

Golang (github.com-PaesslerAG-jsonpath) ¹

Not supported

parsing error: $[?(@.a[?(@.price>10)])]	:1:18 - 1:19 unexpected ">" while scanning parentheses expected ")"

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

[
  {
    "a": [
      {
        "price": 1
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": []
  }
]

Golang (github.com-ohler55-ojg)

Not supported

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-spyzhov-ajson)

[
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  }
]

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

[
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  }
]

Haskell (jsonpath)

Not supported

Invalid JSONPath: $[?(@.a[?(@.price>10)])]
 Error: 1:9:
  |
1 | $[?(@.a[?(@.price>10)])]
  |         ^
unexpected '?'
expecting '!', '"', ''', '+', '-', integer, or white space

JavaScript (brunerd)

Not supported

JavaScript (jsonpath)

Not supported

Lexical error on line 1. Unrecognized text.
...?(@.a[?(@.price>10)])]
-----------------------^

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "a": [
      {
        "price": 1
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": []
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "a": [
      {
        "price": 1
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": []
  }
]

PHP (galbar-jsonpath) ²

Not supported

Invalid JSONPath error: 'Error in JSONPath near '[?(@.price''

PHP (remorhaz-jsonpath)

[
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  }
]

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": [
      {
        "price": 1
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": []
  }
]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

[
  {
    "a": [
      {
        "price": 1
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": []
  }
]

Rust (jsonpath_plus)

[]

Scala (jsonpath)

[
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  }
]

Swift (Sextant)

[
  {
    "a": [
      {
        "price": 1
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  },
  {
    "a": []
  }
]

dotNET (Json.NET)

[
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  }
]

dotNET (JsonCons.JsonPath)

[
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  }
]

dotNET (JsonPath.Net)

[
  {
    "a": [
      {
        "price": 11
      }
    ]
  },
  {
    "a": [
      {
        "price": 8
      },
      {
        "price": 12
      },
      {
        "price": 3
      }
    ]
  }
]

dotNET (Manatee.Json)

Not supported

JSON Path expression indexers only support single constant values. Path up to error: '$'

JSON (Path_Reference_Implementation)

Not supported

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

Proposal (A)

Not supported


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

Errors

JavaScript (Goessner) ²

jsonPath: Unexpected token ?: _v.a[?(_v.price>10)

JavaScript (jsonpath-plus)

Unexpected token '?'

Java (com.github.jsurfer)

java.lang.NullPointerException: Cannot invoke "org.jsfr.json.path.JsonPath$Builder.build()" because "this.filterPathBuilder" is null

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

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

dotNET (JsonPathLib)

Line 1: Unexpected token ?

Footnotes