jmespath / jmespath/jmespath.py

'<' filter works incorrect in some cases

Open
#169 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.4k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

JMESPath fails with `TypeError: unorderable types: int() < str()` error in following case:

test.json
```
[
{
"id": 1,
"sha": "abc",
"ref": "develop",
"status": "running"
},
{
"id": 2,
"sha": "abc",
"ref": "develop",
"status": "running"
}
]
```

sample python script
```
import json

import jmespath

query = "[?id < '2']"
expression = jmespath.compile(query)

with open('test.json') as f:
data = json.load(f)
r = expression.search(data)
print(r)
```

The same example works fine on http://jmespath.org/

jmespath version: 0.9.3

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.