I have created 1 JSONPath which is working fine on https://jsonpath.com/ But I'm configuring in JSON Path expression, it is giving me error :
JSON Path expression assertion failed
Not sure in which format Site 24X7 is accepting below JSON Path :
$.environments[*].dimensions[?(@.name=="SFAPI,NAD_DIGITAL")].metrics[?(@.values > 40)]
Sample JSON :
{
"environments": [
{
"dimensions": [
{
"metrics": [
{
"name": "sum(message_count)",
"values": [
"35.0"
]
}
],
"name": "SFAPI,NAD_SF"
},
{
"metrics": [
{
"name": "sum(message_count)",
"values": [
"44.0"
]
}
],
"name": "SFAPI,NAD_DIGITAL"
}
],
"name": "nad-prod12FFFHHF"
}
],
"metaData": {
"errors": [],
"notices": [
"Table used: uap",
"Source:BB",
"query served by:job_1234"
]
}
}
Hi Nikhil,
Your JSON Path expression assertion have failed as the expression contains this condition"[?(@.values > 40)]".
Comparing '40' as String, this expression got failed. Public online json validator will convert string to int and done validations. But Site24x7 have not done any conversion in the response hence we validated the response as it is. Kindly try this json path expression and give it a try.
$.environments[*].dimensions[?(@.name=="SFAPI,NAD_DIGITAL")].metrics[?(@.values[0] > "40")]
Regards,
Jenzo
Site24x7