Forum Discussion

swright's avatar
swright
New Contributor III
4 years ago
Solved

Jsonpath - how to use parameters or variables inside a jsonpath

Using jsonpath as the expression in a mapper snap the following works:

jsonPath($, “$entity.items[?(@.AssignmentNumber==‘E3163300-2’)].links[*]”).find(x=>x.name == ‘assignedPayrolls’).href

I want to pass in the assignment number from a parameter but this doesn’t seem to work:

jsonPath($, “$entity.items[?(@.AssignmentNumber=='_AssignmentNumber)].links[*]”).find(x=>x.name == ‘assignedPayrolls’).href

This is with parameter _AssignmentNumber set to the value that works which is ‘E3163300-2’

How can I get jsonpath to work with parameters or variables?