mirror of https://github.com/tidwall/gjson.git
array query mismatch, fixes #58
This commit is contained in:
parent
5cd723d566
commit
87033efcae
2
gjson.go
2
gjson.go
|
@ -1077,7 +1077,7 @@ func queryMatches(rp *arrayPathResult, value Result) bool {
|
|||
case "=":
|
||||
return value.Num == rpvn
|
||||
case "!=":
|
||||
return value.Num == rpvn
|
||||
return value.Num != rpvn
|
||||
case "<":
|
||||
return value.Num < rpvn
|
||||
case "<=":
|
||||
|
|
|
@ -1288,3 +1288,10 @@ func TestIssue55(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
func TestIssue58(t *testing.T) {
|
||||
json := `{"data":[{"uid": 1},{"uid": 2}]}`
|
||||
res := Get(json, `data.#[uid!=1]`).Raw
|
||||
if res != `{"uid": 2}` {
|
||||
t.Fatalf("expected '%v', got '%v'", `{"uid": 1}`, res)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue