-
Incident report
-
Resolution: Unresolved
-
Trivial
-
None
-
5.0.7
-
None
-
debian 10, postgres, nginx
Steps to reproduce:
JSONPath erroneously takes into account absent fields when doing math compare operations (<, > and so on).
Let's take an example from documentation with one book without a price:
{
"books": [
{
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95,
"id": 1
},
{
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99,
"id": 2
},
{
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"id": 3
}]
}
If we make a condition with a price less than 10, it grabs a result with a book also with absent field 'price':
$.books[?(@.price <10)]
[{
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95,
"id": 1
},{
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"id": 3
}]
Instead it should ignore a book without that field and should show only one book.