Filter expression with division

Setup

Selector: $[?(@.key/10==5)]

[{"key": 60}, {"key": 50}, {"key": 10}, {"key": -50}, {"key/10": 5}]

Results

Other responses

Bash (JSONPath.sh)

[
  5
]

C (json-glib)

Not supported

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

Clojure (json-path) ¹

[
  {
    "key": 60
  },
  {
    "key": 50
  },
  {
    "key": 10
  },
  {
    "key": -50
  }
]

Cpp (jsoncons)

[
  {
    "key": 50
  }
]

Dart (json_path)

Not supported

FormatException: end of input expected at 1:2. Expression: $[?(@.key/10==5)]

Elixir (ExJsonPath)

Not supported

illegal characters "/"

Elixir (jaxon)

[]

Elixir (warpath) ¹

[
  {
    "key/10": 5
  }
]

Golang (github.com-PaesslerAG-jsonpath) ¹

Not supported

parsing error: $[?(@.key/10==5)]	:1:10 - 1:11 unexpected "/" while scanning parentheses expected ")"

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

[
  {
    "key": 50
  }
]

Golang (github.com-ohler55-ojg)

[
  {
    "key": 50
  }
]

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-spyzhov-ajson)

[
  {
    "key": 50
  }
]

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

[
  {
    "key/10": 5
  }
]

Haskell (jsonpath)

Not supported

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

JavaScript (Goessner) ²

[
  {
    "key": 50
  }
]

JavaScript (brunerd)

[
  {
    "key": 50
  }
]

JavaScript (jsonpath)

[
  {
    "key": 50
  }
]

JavaScript (jsonpath-plus)

[
  {
    "key": 50
  }
]

Java (com.github.jsurfer)

[
  {
    "key/10": 5
  }
]

Java (com.jayway.jsonpath) ¹ ³

Not supported

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
com.jayway.jsonpath.InvalidPathException: Could not find matching close for / when parsing regex in : $[?(@.key/10==5)]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

Not supported

Could not find matching close for / when parsing regex in : $[?(@.key/10==5)]

PHP (galbar-jsonpath) ²

Not supported

Invalid JSONPath error: 'Error in JSONPath near '/10''

PHP (remorhaz-jsonpath)

Not supported

Error: 'Failed to build AST from JSONPath query: $[?(@.key/10==5)]'

PHP (softcreatr-jsonpath)

[
  {
    "key/10": 5
  }
]

Python (jsonpath) ²

[
  {
    "key": 50
  }
]

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

Raku (JSON-Path)

Not supported

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

Ruby (jsonpath)

[
  {
    "key": 60
  },
  {
    "key": 50
  },
  {
    "key": 10
  },
  {
    "key": -50
  }
]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

[
  {
    "key/10": 5
  }
]

Rust (jsonpath_plus)

[]

Scala (jsonpath)

[
  {
    "key/10": 5
  }
]

Swift (Sextant)

Not supported

NOT_SUPPORTED

dotNET (Json.NET)

[
  {
    "key/10": 5
  }
]

dotNET (JsonCons.JsonPath)

[
  {
    "key": 50
  }
]

dotNET (JsonPath.Net)

[
  {
    "key": 50
  }
]

dotNET (JsonPathLib)

[
  {
    "key": 50
  }
]

dotNET (Manatee.Json)

[
  {
    "key": 50
  }
]

JSON (Path_Reference_Implementation)

Not supported

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

Proposal (A)

Not supported


x 1:10-1:10 ComparisonOperator
| $[?(@.key/10==5)]
|          ^
| x 1:10-1:10 ScalarOperator
| | $[?(@.key/10==5)]
| |          ^
| o 1:5-1:10 DocumentValue
| | $[?(@.key/10==5)]
| |     ^^^^^
| o 1:5-1:10 UnaryFilterExpression
| | $[?(@.key/10==5)]
| |     ^^^^^
| | x 1:10-1:10 ScalarOperator
| | | $[?(@.key/10==5)]
| | |          ^
| | o 1:5-1:10 DocumentValue
| | | $[?(@.key/10==5)]
| | |     ^^^^^
| | o 1:5-1:10 FilterValue
| | | $[?(@.key/10==5)]
| | |     ^^^^^
| | | 
|/ /  
| | 
|/  
o 1:5-1:10 HigherPrecedenceFilterExpression
| $[?(@.key/10==5)]
|     ^^^^^
x 1:5-1:5 LogicalOr
| $[?(@.key/10==5)]
|     ^
| x 1:10-1:10 ComparisonOperator
| | $[?(@.key/10==5)]
| |          ^
| | x 1:10-1:10 ScalarOperator
| | | $[?(@.key/10==5)]
| | |          ^
| | o 1:5-1:10 DocumentValue
| | | $[?(@.key/10==5)]
| | |     ^^^^^
| | o 1:5-1:10 UnaryFilterExpression
| | | $[?(@.key/10==5)]
| | |     ^^^^^
| | | x 1:10-1:10 ScalarOperator
| | | | $[?(@.key/10==5)]
| | | |          ^
| | | o 1:5-1:10 DocumentValue
| | | | $[?(@.key/10==5)]
| | | |     ^^^^^
| | | o 1:5-1:10 FilterValue
| | | | $[?(@.key/10==5)]
| | | |     ^^^^^
| | | | 
| |/ /  
| | | 
| |/  
| o 1:5-1:10 HigherPrecedenceFilterExpression
| | $[?(@.key/10==5)]
| |     ^^^^^
| x 1:5-1:5 LogicalAnd
| | $[?(@.key/10==5)]
| |     ^
| | x 1:10-1:10 ComparisonOperator
| | | $[?(@.key/10==5)]
| | |          ^
| | | x 1:10-1:10 ScalarOperator
| | | | $[?(@.key/10==5)]
| | | |          ^
| | | o 1:5-1:10 DocumentValue
| | | | $[?(@.key/10==5)]
| | | |     ^^^^^
| | | o 1:5-1:10 UnaryFilterExpression
| | | | $[?(@.key/10==5)]
| | | |     ^^^^^
| | | | x 1:10-1:10 ScalarOperator
| | | | | $[?(@.key/10==5)]
| | | | |          ^
| | | | o 1:5-1:10 DocumentValue
| | | | | $[?(@.key/10==5)]
| | | | |     ^^^^^
| | | | o 1:5-1:10 FilterValue
| | | | | $[?(@.key/10==5)]
| | | | |     ^^^^^
| | | | | 
| | |/ /  
| | | | 
| | |/  
| | o 1:5-1:10 HigherPrecedenceFilterExpression
| | | $[?(@.key/10==5)]
| | |     ^^^^^
| | | 
|/ /  
| | 
|/  
o 1:5-1:10 FilterExpression
| $[?(@.key/10==5)]
|     ^^^^^
x 1:3-1:3 BracketElement
| $[?(@.key/10==5)]
|   ^
x 1:3-1:3 BracketElements
| $[?(@.key/10==5)]
|   ^
x 1:2-1:2 BracketChildren
| $[?(@.key/10==5)]
|  ^
x 1:2-1:2 Operator
| $[?(@.key/10==5)]
|  ^
o 1:1-1:2 Start
  $[?(@.key/10==5)]
  ^

Errors

Erlang (ejsonpath)

init terminating in do_boot ({not_implemented,bin_op,/})

Crash dump is being written to: /dev/null...done
{"init terminating in do_boot",{not_implemented,bin_op,'/'}}

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

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

Footnotes