jsonPath doesn't work with process variables

Hallo. Help me please to solve my issue with jsonPath using process variable. I’m using Activity of type Script Task. I try to execute script:

_configuration.jsonPath(“$.InsuranceContractViolation[?(ContractType in @.ContrType)]”).element();

where ContractType is the process variable.
And I’m getting error:
.SpinJsonPathException: SPIN/JACKSON-JSON-01014 Unable to compile ‘$.InsuranceContractViolation[?(ContractType in @.ContrType)]’!

When I replace ContractType with string ‘LeaseAuction’ this work.

I solved It.

var query = “$.InsuranceContractViolation[?(’” + ContractType + “’ in @.ContrType)]”;
_configuration.jsonPath(query).element();

1 Like