-
-
Notifications
You must be signed in to change notification settings - Fork 192
Closed
Labels
Description
Describe the bug
This error gets thrown if match field does not exist
Code sample or steps to reproduce
{
"items":[
{
"name": "John Doe",
"country": "USA"
},
{
"country": "USA",
"age":25
}
]
}
//fails
$.items[?(@.name.match(/.*oe/))]
//only way to make it work
$.items[?(@.name && @.name.match(/.*oe/))]
Console error or logs
Error: jsonPath: Cannot read properties of undefined (reading 'match'): @.name.match(/.*abc/)
at JSONPath.Object.<anonymous>.JSONPath._eval
at JSONPath.Object.<anonymous>.JSONPath._walk
at JSONPath.Object.<anonymous>.JSONPath._trace
at JSONPath.Object.<anonymous>.JSONPath._trace
at JSONPath.Object.<anonymous>.JSONPath.evaluate
Expected behavior
no error gets thrown, no results returned
Environment (IMPORTANT)
- JSONPath-Plus version:v7.2.0
Desktop**
- NodeJS and browser