Filter expression with greater than

Setup

Selector: $[?(@.key>42)]

[
    {"key": 0},
    {"key": 42},
    {"key": -1},
    {"key": 41},
    {"key": 43},
    {"key": 42.0001},
    {"key": 41.9999},
    {"key": 100},
    {"key": "43"},
    {"key": "42"},
    {"key": "41"},
    {"key": "value"},
    {"some": "value"}
]

Results

Other responses

Bash (JSONPath.sh)

[
  43,
  42.0001,
  100
]

C (json-glib)

Not supported

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

Clojure (json-path) ¹

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Cpp (jsoncons)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Dart (json_path)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Elixir (ExJsonPath)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  },
  {
    "key": "42"
  },
  {
    "key": "41"
  },
  {
    "key": "value"
  }
]

Elixir (jaxon)

[]

Elixir (warpath) ¹

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  },
  {
    "key": "42"
  },
  {
    "key": "41"
  },
  {
    "key": "value"
  },
  {
    "some": "value"
  }
]

Erlang (ejsonpath)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  },
  {
    "key": "42"
  },
  {
    "key": "41"
  },
  {
    "key": "value"
  },
  {
    "some": "value"
  }
]

Golang (github.com-PaesslerAG-jsonpath) ¹

Not supported

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

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

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  }
]

Golang (github.com-ohler55-ojg)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-spyzhov-ajson)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

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

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Haskell (jsonpath)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

JavaScript (Goessner) ²

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  }
]

JavaScript (brunerd)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  }
]

JavaScript (jsonpath)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  }
]

JavaScript (jsonpath-plus)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  }
]

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  },
  {
    "key": "value"
  }
]

PHP (galbar-jsonpath) ²

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  }
]

PHP (remorhaz-jsonpath)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

PHP (softcreatr-jsonpath)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  },
  {
    "key": "value"
  }
]

Python (jsonpath) ²

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

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)

Rust (jsonpath)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Rust (jsonpath_lib)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Rust (jsonpath_plus)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Scala (jsonpath)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Swift (Sextant)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  },
  {
    "key": "value"
  }
]

dotNET (JsonCons.JsonPath)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

dotNET (JsonPath.Net)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

dotNET (JsonPathLib)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  },
  {
    "key": "43"
  }
]

dotNET (Manatee.Json)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

JSON (Path_Reference_Implementation)

Not supported

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

Proposal (A)

[
  {
    "key": 43
  },
  {
    "key": 42.0001
  },
  {
    "key": 100
  }
]

Errors

Java (com.github.jsurfer)

java.lang.NumberFormatException: Character " is neither a decimal digit number, decimal point, nor "e" notation exponential mark.

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

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

Ruby (jsonpath)

comparison of String with 42.0 failed

dotNET (Json.NET)

Input string was not in a correct format.

Footnotes