Skip to content

Commit

Permalink
Fix issue with json path when expected path doesn't match actual path
Browse files Browse the repository at this point in the history
  • Loading branch information
TwiN committed Jul 24, 2020
1 parent 60e30da commit 9822162
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jsonpath/jsonpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ func extractValue(currentKey string, value interface{}) interface{} {
}
return nil
}
if value == nil || value.(map[string]interface{})[currentKey] == nil {
return nil
}
// if currentKey contains both a key and an index (i.e. data[0])
array := value.(map[string]interface{})[currentKey].([]interface{})
if len(array) > arrayIndex {
Expand Down

0 comments on commit 9822162

Please sign in to comment.