Filter expression with less 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)
[
0,
-1,
41,
41.9999,
"43",
"42",
"41",
"value"
]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.key<42)]': Invalid array index definition “?(@.key<42)]”
Clojure (json-path)
¹
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Cpp (jsoncons)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Dart (json_path)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Elixir (ExJsonPath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Erlang (ejsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Not supported
parsing error: $[?(@.key<42)] :1:10 - 1:11 unexpected "<" while scanning parentheses expected ")"
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
},
{
"key": "41"
}
]
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
[]
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Haskell (jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
JavaScript (Goessner)
²
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
},
{
"key": "41"
}
]
JavaScript (brunerd)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
},
{
"key": "41"
}
]
JavaScript (jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
},
{
"key": "41"
}
]
JavaScript (jsonpath-plus)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
},
{
"key": "41"
}
]
JavaScript (jsonpathly)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Java (com.jayway.jsonpath)
¹
³
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
},
{
"key": "41"
}
]
PHP (galbar-jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
},
{
"key": "41"
}
]
PHP (remorhaz-jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
PHP (softcreatr-jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
},
{
"key": "41"
}
]
Python (jsonpath)
²
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
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)
[]
Python (python-jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Rust (jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Rust (jsonpath_lib)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Rust (jsonpath_plus)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Rust (serde_json_path)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Scala (jsonpath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
Swift (Sextant)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
},
{
"key": "41"
}
]
dotNET (JsonCons.JsonPath)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
dotNET (JsonPath.Net)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
dotNET (JsonPathLib)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
},
{
"key": "41"
}
]
dotNET (Manatee.Json)
[
{
"key": 0
},
{
"key": -1
},
{
"key": 41
},
{
"key": 41.9999
}
]
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
- ¹ This implementation returns a single value where only one match is possible (instead of an array of a single value).
- ² This implementation returns a specific not found value if no match exists.
- ³ This implementation returns a specific not found value if a query that would regularly return a single match results in no match.