06-02-2021 03:08 PM
Below is my input, i am trying filter for id where type == file and name begins with “Send Email”
expression i used in mapper jsonPath($, “entity.entries[?(@.type == ‘file’ && @.name =~ /Send Email.*?/i)].id”) but i am getting error Please check expression syntax and data types.
"entries":[
{
"type":
"folder"
"id":
"138491898043",
"name":
"processed Template"
}
{
"type":
"file"
"id":
"817753844208",
"name":
"Send Email Template (1).xlsx"
}
{
"type":
"file"
"id":
"817352978835",
"name":
"Send Email Template.xlsx"
},
{
"type":
"file"
"id":
"81735297",
"name":
"Hello World.xlsx"
},
]
Solved! Go to Solution.
08-19-2021 08:26 PM
Thank you all!!
jsonPath($, “entity.entries[*]”).filter(x => x.hasPath(‘type’) && x.type == ‘file’ && x.hasPath(‘name’) && x.name.startsWith(‘Send Email’)).length >0
This worked!
06-02-2021 10:25 PM
Hi @npise,
You can use the following expression:
$entries.filter(x=>x.type == ‘file’ && x.name.startsWith(‘Send Email’)).map(y=>y.id)
You’ll get an array of id’s that match the condition.
Regards,
Bojan
06-03-2021 11:11 PM
Can also try below expression-
jsonPath($, "$entries[?(value[‘type’] == ‘file’ && value[‘name’].startsWith('Send
08-19-2021 08:26 PM
Thank you all!!
jsonPath($, “entity.entries[*]”).filter(x => x.hasPath(‘type’) && x.type == ‘file’ && x.hasPath(‘name’) && x.name.startsWith(‘Send Email’)).length >0
This worked!