jmespath / jmespath/go-jmespath
Unable to match data on map[string]struct
- Dominant language
- Go
- Stars
- 621
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
I'm having an issue when executing a JMESPATH query on a `map[string]customType`, here's the code :
```go
type testStruct struct {
Value interface{} `json:"value"`
}
func main() {
test1 := map[string]interface{}{
"entry": testStruct{Value: 1},
}
result1, err := jmespath.Search("entry.value", test1)
fmt.Printf("\nerr = %v : res = %+v\n", err, result1) // displays err = nil : res = 1
test2 := map[string]testStruct{
"entry": testStruct{Value: 1},
}
result2, err := jmespath.Search("entry.value", test2)
fmt.Printf("\nerr = %v : res = %+v\n", err, result2) // displays err = nil : res = nil
}
```
As you can see, a query on a `map[string]interface{}` behaves as expected, whereas `nil` is returned when executing the same query on a `map[string]testStruct` (adding a pointer to `testStruct` results in the same output).
Has anyone ever experienced such a problem ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.