hi Community
I have the following JSON as a response from a data action.
{
"receptionists": [
{
"name": "Giovanni Fuenzalida Herrera",
"workshopId": 232,
"active": true,
"id": 7599,
"time": 30,
"scheduleId": "HCP",
"validsBrands": [
"NI",
"IF"
]
},
{
"name": "CLAUDIO ANTONIO CABRERA MIRANDA",
"workshopId": 232,
"active": true,
"id": 1901,
"time": 30,
"scheduleId": "HCP",
"validsBrands": [
"NI",
"IF"
]
},
{
"name": "Diego Andres Contreras Zambrano",
"workshopId": 232,
"active": true,
"id": 4427,
"time": 30,
"scheduleId": "HCP",
"validsBrands": [
"NI"
]
},
{
"name": "ASESOR LA DEHESA",
"workshopId": 232,
"active": true,
"id": 23108,
"time": 30,
"scheduleId": "MG",
"validsBrands": [
"MG"
]
},
{
"name": "DIEGO LEONARDO CAMPROVIN AROS",
"workshopId": 232,
"active": true,
"id": 5549,
"time": 30,
"scheduleId": "HCP",
"validsBrands": [
"NI",
"IF"
]
}
]
}
From the response json, I need to filter the names of the objects that have the code 'NI' as validBrands
I have managed to do it using this code inside "translationMap"
{
"translationMap": {
"name": "$.receptionists[?('NI' in @.validsBrands)].name",
"workshopId": "$.receptionists[?('NI' in @.validsBrands)].workshopId",
"id": "$.receptionists[?('NI' in @.validsBrands)].id"
},
"translationMapDefaults": {
"name": "[]",
"workshopId": "[]",
"id": "[]"
},
"successTemplate": "{ \n \n "name":${name} \n, \n "workshopId":${workshopId} \n, \n "id":${id} \n }"
Now the question goes to how can I adjust the code of translationMap ($.receptionists[?('NI' in @.validsBrands)].name) so that it can accept any other code for validsBrands (example MG)