You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not working..
Can you please tell me if this is supported or not?
It is working if i specify this path - $.childobj.phoneNumbers.[0].type where no condition is specified. Whereas in the above path I have specified the condition.
The text was updated successfully, but these errors were encountered:
I think it's because Json-Path always returns the result in the form of an array when we have a where condition in our json-path like this
$.childobj.phoneNumbers.[?(@.number=='0123-4567-8888')].type - the return type of this selection is an array.
But when we don't have a where condition, the result it returns is in the form of a string. We can validate this in the javascript
$.childobj.phoneNumbers.[0].type - the return type of this selection is a string
Hence while matching these values it results in false as the data types are completely different.
So what I did was while deriving the factvalue from the almanac.js file inside the factValue method I just added the below line of code
After this change it is working for me. Can I use this fix to support this or will it break anything else. Please confirm me.
Meenakshise
changed the title
Not able to resolve JsonPath specified in the condition
Not able to resolve JsonPath when it includes a where condition
Oct 25, 2022
I have specified this as my condition
conditions: {
all: [{
fact: 'displayMessage',
operator: 'equal',
value: "iphone",
path:"$.childobj.phoneNumbers.[?(@.number=='0123-4567-8888')].type"
}]
And this is the fact -
const facts = { displayMessage: {"childobj" : { "age" : 45 , "phoneNumbers": [
{
"type": "iphone",
"number": "0123-4567-8888"
},
{
"type": "home",
"number": "0123-4567-8910"
}
]} } }
It is not working..
Can you please tell me if this is supported or not?
It is working if i specify this path - $.childobj.phoneNumbers.[0].type where no condition is specified. Whereas in the above path I have specified the condition.
The text was updated successfully, but these errors were encountered: