Evaluating against complex object arrays


I want to define a DMN rule that evaluates against a complex object array. I wrote my rules with FEEL until now and find it to be readable enough so I like it. But I can’t wrap my head around how to handle complex object arrays. So the array with complex objects is quite simple actually:

        "policyId": "13493345",
        "title": "sometext",
        "roles": [
                "partyId": 12345,
                "role": "PolicyHolder"
                "partyId": 349834,
                "role": "Payer"

So we can ignore the outer “policy” array as for now I only ever expect to be a single policy present:


will do that. But inside this policy he have a list of roles. What I need to do is find the role that has the property “role”: “policyHolder” - but then I want to actually compare the partyId property of the same object to some other variable from the decision table.

Something like (pseudo code):

policy[1].roles[“role” = “policyHolder”].partyId = someOtherIntVariable

FEEL seems to only able to work with basic values but I also read you might be able to use Spin within FEEL to do some basic JSON transformations - but I can’t seem to find a way to get this working and I’m also unable to find examples.

From other posts it looks like using JavaScript would be my best option as the expression language but on the other hand I feel in that case I might as well just write more complex code in external workers in the first place.

Does anybody has any ideas how to handle this in an as simple/understandable as possible way?


Hi @jack :wave:

The expression is almost correct. Try the following:

(policy[1].roles[role = "PolicyHolder"]).partyId[1] = x

Since roles is a list of values, you need to access a specific element or use a different operation.

Does this help you?

Best regards,


Hi @Philipp_Ossler

ha - wow. This is actually quite amazing. I actually didn’t even try to put an equality operation into the array brackets as I didn’t expect to be able to put any operations in there, not even talking about accessing properties by name in there.

This is something I really couldn’t find in the FEEL Scala docs.

Thank you very much, you have no idea how much that helps me! :wink:

1 Like