We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose engine fails on valid JSON

Hi Aspose team,

I’ve came across a bug in your Linq reporting engine.

Scenario:
Having a template input file in docx that contains data references and a valid JSON . When sending these two inputs to the engine it produces an illegalstate exception.

The crux is that if you modify the same json an put a dummy entry BEFORE the actual data in the JSON it does the job.

As you can imagine, manipulating a JSON before sending it the the engine is quite delicate and a workaround for the time being, it would be great if you guys can take this on.

I created a test project for you to validate this issue and attached that here : AsposeJsonTest.zip (70.7 KB)
.

Can you investigate this from your end ?

Many thanks,
Jeffrey

@Jeffrey1

Please use ReportingEngine.Options property as shown below to avoid the shared issue. Hope this helps you.

ReportingEngine engine = new ReportingEngine();
engine.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS); 
// Build report.
engine.buildReport(doc, dataSource, "");

@tahir.manzoor thanks for your answer, this worked. Is there any way this can be documented? I’m unable to read this in the java documentation.

@Jeffrey1,

Please refer to the following section of Aspose.Words for Java’s documentation:

perfect @awais.hafeez ! thanks for pointing me the docs.

@awais.hafeez @tahir.manzoor I have to revisit your proposed solution as it is not doing as it should.

Adding allow missing members is allowing invalid template syntax to proceed. I tested with below invalid template(zip) and valid json and it just stops generating after the first syntax error but does build a report.

at first, the first provided scenario provides a valid json and there are no missing members in the json (the zipped project). So adding allow missing members there not a solution to the issue as there are no missing members. In fact there is a valid json with all members provided. it is just that the first member is having an object instead of a string value.

second, the expected behavior is that in case you do provide a missing member or invalid template syntax it should come back with the exception.

third, it seems a json object holding an object is not supported on a first row. if you put a value pair “”:"" on the first row it works.

Can you revisit and test the attached project with the above input?

please note to add the allow missing members to the attached project.

invalid template.zip (22.4 KB)

@Jeffrey1,

We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-21972. We will further look into the details of this problem and will keep you updated on the status of the linked issue.

thanks @awais.hafeez!

The issues you have found earlier (filed as WORDSNET-21972) have been fixed in this Aspose.Words for .NET 21.6 update and this Aspose.Words for Java 21.6 update.