LINQ Reporting : How to handle enumeration when list might be missing?

I am trying to build a document template that uses dynamically generated JSON data to output a finished document. One of the sections requires certain output if a list exists and contains a certain value. I’ve provided a simplified example which produces the same results:

Example input:

{ "party": "yes", "person": { "who": ["Fred", "Jim"] } }

Example code inside Word document template:

<<if [person.who.any(e => e.who_Text == "Jim")]>>Jim is here<<else>>Jim is not here<</if>>

Java code for triggering the reporting engine:

 Document doc = new Document(docTemplate);

 JsonDataLoadOptions options = new JsonDataLoadOptions();
 options.setAlwaysGenerateRootObject(true);
 options.setSimpleValueParseMode(JsonSimpleValueParseMode.LOOSE);

 JsonDataSource dataSource = new JsonDataSource(new ByteArrayInputStream(json.getBytes(Charset.defaultCharset())), options);

        ReportingEngine engine = new ReportingEngine();
        engine.setOptions(ReportBuildOptions.fromNames(Set.of(
            "ALLOW_MISSING_MEMBERS",
            "INLINE_ERROR_MESSAGES"
        )));
        engine.buildReport(doc, dataSource);

This works great, however if I pass in this input (even with the ALLOW_MISSING_MEMBERS option enabled) it gives me the following error:

Input:

{ "party": "no" }

Error! A conditional expression should return a Boolean value

I have tried adding a null check around it like this: <<if [person.who != null]>> without success as it seems to evaluate the inner if statement anyway. Is there any way I can get this to work so that the <> is executed if “person.who” is null/missing?

Thanks in advance for your help.

This topic has been moved to the related forum: LINQ Reporting Engine - How to handle enumeration when list might be missing? - Free Support Forum - aspose.com