Filter expression with subtraction

Setup

Selector: $[?(@.key-50==-100)]

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

Results

Other responses

Bash (JSONPath.sh)

[
  -100
]

C (json-glib)

Not supported

Unable to compile selector `$[?(@.key-50==-100)]': Invalid array index definition “?(@.key-50==-100)]”

Clojure (json-path) ¹

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

Cpp (jsoncons)

[
  {
    "key": -50
  }
]

Dart (json_path)

Not supported

Instance of 'ParserException': end of input expected (at 1:2)

Elixir (ExJsonPath)

Not supported

syntax error before: -50

Elixir (jaxon)

[]

Elixir (warpath) ¹

[
  {
    "key-50": -100
  }
]

Erlang (ejsonpath)

Not supported

syntax error before: '-'

Golang (github.com-PaesslerAG-jsonpath) ¹

Not supported

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

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

[
  {
    "key": -50
  }
]

Golang (github.com-ohler55-ojg)

Not supported

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-theory-jsonpath)

Not supported

jsonpath: expected ')' but found integer at position 10

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

[
  {
    "key-50": -100
  }
]

Haskell (jsonpath)

Not supported

Invalid JSONPath: $[?(@.key-50==-100)]
 Error: 1:15:
  |
1 | $[?(@.key-50==-100)]
  |               ^^^^^
unexpected "-100)"
expecting "false", "null", "true", '!', '"', '$', ''', '@', digit, or white space

JavaScript (Goessner) ²

[
  {
    "key": -50
  }
]

JavaScript (brunerd)

[
  {
    "key": -50
  }
]

JavaScript (json-p3)

[
  {
    "key-50": -100
  }
]

JavaScript (jsonpath)

[
  {
    "key": -50
  }
]

JavaScript (jsonpath-plus)

[
  {
    "key": -50
  }
]

JavaScript (jsonpathly)

[
  {
    "key": -50
  }
]

Java (com.github.jsurfer)

[
  {
    "key-50": -100
  }
]

Java (com.github.xmljacquard.ajp)

Not supported

Error at char 18 in expression in xsl:sequence/@select on line 20 column 67 of ajp-runner.xslt:
   <failed xmlns:ixml="http://invisiblexml.org/NS"
  ixml:state="failed"><line>1</line><column>10</column><pos>10</pos><unexpected>-</unexpected><permitted>#9, #A, #D, ' ', '!', '.', '&lt;', '=', '&gt;', '[', '_', [#80-'퟿[xd7ff]'], ['0'-'9'], ['A'-'Z'; 'a'-'z'], ['𐀀[x10000]'-'􏿯[x10ffef]'], ['[xe000]'-'￯[xffef]']</permitted><completions><completed rule="member-name-shorthand" start="7" end="9"><input>key</input></completed><completed rule="name-segment" start="6" end="9"><input>.key</input></completed><completed rule="child-segment" start="6" end="9"><input>.key</input></completed><completed rule="segment" start="6" end="9"><input>.key</input></completed><completed rule="singular-query-segments" start="6" end="9"><input>.key</input></completed><completed rule="rel-singular-query" start="5" end="9"><input>@.key</input></completed><completed rule="segments" start="6" end="9"><input>.key</input></completed><completed rule="singular-query" start="5" end="9"><input>@.key</input></completed></completions><could-be-next><in rule="bracketed-selection"><tokens>'['</tokens></in><in rule="comparison-op"><tokens>'!', '&lt;', '=', '&gt;'</tokens></in><in rule="ALPHA"><tokens>['A'-'Z'; 'a'-'z']</tokens></in><in rule="index-segment"><tokens>'['</tokens></in><in rule="DIGIT"><tokens>['0'-'9']</tokens></in><in rule="name-segment"><tokens>'.', '['</tokens></in><in rule="descendant-segment"><tokens>'.'</tokens></in><in rule="B"><tokens>#9, #A, #D, ' '</tokens></in><in rule="child-segment"><tokens>'.'</tokens></in><in rule="name-first"><tokens>'_', [#80-'퟿[xd7ff]'], ['𐀀[x10000]'-'􏿯[x10ffef]'], ['[xe000]'-'￯[xffef]']</tokens></in></could-be-next><unfinished><open rule="paren-expr" start="4" end="9"><input>(@.key</input></open><open rule="filter-selector" start="3" end="3"><input>?</input></open><open rule="bracketed-selection" start="2" end="2"><input>[</input></open><open rule="jsonpath-query" start="1" end="1"><input>$</input></open></unfinished></failed>
During lazy evaluation of tailCallLoop(ajp:getProcessor(...)) on line 20 of jar:file:./implementations/Java_com.github.xmljacquard.ajp/build/deps/org/xmljacquard/ajp/0.0.7/ajp-0.0.7.jar!/xslt/ajp-runner.xslt
In function ajpr:getProcessor on line 17 column 106 of ajp-runner.xslt:
net.sf.saxon.s9api.SaxonApiException: <failed xmlns:ixml="http://invisiblexml.org/NS" ixml:state="failed"><line>1</line><column>10</column><pos>10</pos><unexpected>-</unexpected><permitted>#9, #A, #D, ' ', '!', '.', '&lt;', '=', '&gt;', '[', '_', [#80-'퟿'], ['0'-'9'], ['A'-'Z'; 'a'-'z'], ['𐀀'-'􏿯'], [''-'￯']</permitted><completions><completed rule="member-name-shorthand" start="7" end="9"><input>key</input></completed><completed rule="name-segment" start="6" end="9"><input>.key</input></completed><completed rule="child-segment" start="6" end="9"><input>.key</input></completed><completed rule="segment" start="6" end="9"><input>.key</input></completed><completed rule="singular-query-segments" start="6" end="9"><input>.key</input></completed><completed rule="rel-singular-query" start="5" end="9"><input>@.key</input></completed><completed rule="segments" start="6" end="9"><input>.key</input></completed><completed rule="singular-query" start="5" end="9"><input>@.key</input></completed></completions><could-be-next><in rule="bracketed-selection"><tokens>'['</tokens></in><in rule="comparison-op"><tokens>'!', '&lt;', '=', '&gt;'</tokens></in><in rule="ALPHA"><tokens>['A'-'Z'; 'a'-'z']</tokens></in><in rule="index-segment"><tokens>'['</tokens></in><in rule="DIGIT"><tokens>['0'-'9']</tokens></in><in rule="name-segment"><tokens>'.', '['</tokens></in><in rule="descendant-segment"><tokens>'.'</tokens></in><in rule="B"><tokens>#9, #A, #D, ' '</tokens></in><in rule="child-segment"><tokens>'.'</tokens></in><in rule="name-first"><tokens>'_', [#80-'퟿'], ['𐀀'-'􏿯'], [''-'￯']</tokens></in></could-be-next><unfinished><open rule="paren-expr" start="4" end="9"><input>(@.key</input></open><open rule="filter-selector" start="3" end="3"><input>?</input></open><open rule="bracketed-selection" start="2" end="2"><input>[</input></open><open rule="jsonpath-query" start="1" end="1"><input>$</input></open></unfinished></failed>

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "key-50": -100
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "key-50": -100
  }
]

PHP (galbar-jsonpath)

[
  {
    "key-50": -100
  }
]

PHP (remorhaz-jsonpath)

[
  {
    "key-50": -100
  }
]

PHP (softcreatr-jsonpath)

[
  {
    "key-50": -100
  }
]

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 mismatched input '-50' expecting ')'
ValueError("line 1:9 mismatched input '-50' expecting ')'")

Python (python-jsonpath)

[
  {
    "key-50": -100
  }
]

Raku (JSON-Path)

Not supported

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

Ruby (jsonpath)

[]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

[
  {
    "key-50": -100
  }
]

Rust (jsonpath_plus)

[
  {
    "key-50": -100
  }
]

Rust (serde_json_path)

Not supported

at position 3, in long-hand segment, parser error

Scala (jsonpath)

[
  {
    "key-50": -100
  }
]

Swift (Sextant)

[
  {
    "key-50": -100
  }
]

dotNET (Json.NET)

[
  {
    "key-50": -100
  }
]

dotNET (JsonCons.JsonPath)

[
  {
    "key": -50
  }
]

dotNET (JsonPath.Net)

[
  {
    "key": -50
  }
]

dotNET (JsonPathLib)

[
  {
    "key": -50
  }
]

dotNET (Manatee.Json)

[
  {
    "key": -50
  }
]

Errors

Golang (github.com-spyzhov-ajson)

wrong request: wrong request: ?(@.key-50==-100)

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

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

Footnotes