summaryrefslogtreecommitdiffstats
path: root/pkg/jsonpath/jsonpath.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/jsonpath/jsonpath.go')
-rw-r--r--pkg/jsonpath/jsonpath.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkg/jsonpath/jsonpath.go b/pkg/jsonpath/jsonpath.go
index 6b11660..af18607 100644
--- a/pkg/jsonpath/jsonpath.go
+++ b/pkg/jsonpath/jsonpath.go
@@ -253,12 +253,14 @@ func (j *JSONPath) evalArray(input []reflect.Value, node *ArrayNode) ([]reflect.
// evalUnion evaluates UnionNode
func (j *JSONPath) evalUnion(input []reflect.Value, node *UnionNode) ([]reflect.Value, error) {
result := []reflect.Value{}
- for _, listNode := range node.Nodes {
- temp, err := j.evalList(input, listNode)
- if err != nil {
- return input, err
+ for _, inputValue := range input {
+ for _, listNode := range node.Nodes {
+ temp, err := j.evalList([]reflect.Value{inputValue}, listNode)
+ if err != nil {
+ return input, err
+ }
+ result = append(result, temp...)
}
- result = append(result, temp...)
}
return result, nil
}