My Json response looks like this and I am trying to get the values for custom_activity.actitype_1AC8KLe2XghWuNlO93LMv5.count inside data object for each date.
My jsonata query is
data. {
"value": custom_activity.actitype_1AC8KLe2XghWuNlO93LMv5.count,
"date": datetime
}
I know the reason why this is happening is because of the "." inside the custom_activity.actitype_1AC8KLe2XghWuNlO93LMv5.count. But I can't change it as it belongs to a third party and I have no control over that. So I am unable to find a way around this to get the values using jsonata.
It works when i remove the dots in the custom_activity.actitype_1AC8KLe2XghWuNlO93LMv5.count object. So the dots are the reason why this is happening.
{
"aggregations": {
"totals": {
"custom_activity.actitype_1AC8KLe2XghWuNlO93LMv5.count": 87,
"custom_activity.actitype_3hhepbDK50KhtrV9cnLTiN.count": 103,
"custom_activity.actitype_3s8V7iv8ka6zFii5KVr8oF.count": 265,
"custom_activity.actitype_3xec3f7Z3tP8fRo6l8mh00.count": 88,
"custom_activity.actitype_4izlAyTeClOO50BLjHHC9F.count": 328,
"custom_activity.actitype_4nTymVIz4li2swFSUIQCjB.count": 70,
"custom_activity.actitype_6sq5Xno7A5Oi7zWimxWSdx.count": 39
}
},
"data": [{
"custom_activity.actitype_1AC8KLe2XghWuNlO93LMv5.count": 0,
"custom_activity.actitype_3hhepbDK50KhtrV9cnLTiN.count": 0,
"custom_activity.actitype_3s8V7iv8ka6zFii5KVr8oF.count": 7,
"custom_activity.actitype_3xec3f7Z3tP8fRo6l8mh00.count": 0,
"custom_activity.actitype_4izlAyTeClOO50BLjHHC9F.count": 11,
"custom_activity.actitype_4nTymVIz4li2swFSUIQCjB.count": 0,
"custom_activity.actitype_6sq5Xno7A5Oi7zWimxWSdx.count": 0,
"datetime": "2024-01-01T00:00:00+00:00"
}, {
"custom_activity.actitype_1AC8KLe2XghWuNlO93LMv5.count": 3,
"custom_activity.actitype_3hhepbDK50KhtrV9cnLTiN.count": 3,
"custom_activity.actitype_3s8V7iv8ka6zFii5KVr8oF.count": 34,
"custom_activity.actitype_3xec3f7Z3tP8fRo6l8mh00.count": 3,
"custom_activity.actitype_4izlAyTeClOO50BLjHHC9F.count": 27,
"custom_activity.actitype_4nTymVIz4li2swFSUIQCjB.count": 0,
"custom_activity.actitype_6sq5Xno7A5Oi7zWimxWSdx.count": 0,
"datetime": "2024-01-02T00:00:00+00:00"
}, {
"custom_activity.actitype_1AC8KLe2XghWuNlO93LMv5.count": 10,
"custom_activity.actitype_3hhepbDK50KhtrV9cnLTiN.count": 5,
"custom_activity.actitype_3s8V7iv8ka6zFii5KVr8oF.count": 12,
"custom_activity.actitype_3xec3f7Z3tP8fRo6l8mh00.count": 3,
"custom_activity.actitype_4izlAyTeClOO50BLjHHC9F.count": 20,
"custom_activity.actitype_4nTymVIz4li2swFSUIQCjB.count": 6,
"custom_activity.actitype_6sq5Xno7A5Oi7zWimxWSdx.count": 2,
"datetime": "2024-01-03T00:00:00+00:00"
}]
}
You can wrap your path for the
valueproperty in backticks, that way JSONata will consider it a single path segment and work as expected:Check it out live on the Stedi Playground: https://stedi.link/CTr8rLv