Free Support Forum - aspose.com

Generate Word Documents (Reports) from Templates using JSON Data Source in C# .NET | LINQ Reporting Engine | foreach

I sucessfully implemented the example from this blog entry in java: https://blog.aspose.com/2020/03/05/generate-word-documents-from-templates-in-csharp-net/

Unfortunately, if I try to use my own (simpler) json (with my own simpler template with just one foreach) I always get an exception from within the Aspose library:
java.lang.IllegalStateException: Expression tag is not well-formed. Character ‘[’ is unexpected.

Here’s my json:

[
   {
      "strasse": "Einsstr.",
      "hsnr": "1 a",
      "idx":1
   },
   {
      "strasse": "Zweistr.",
      "hsnr": "2",
      "idx":2
   }
] 

Json validators say my json is well-formed.
What am I missing?

@akopp,

To ensure a timely and accurate response, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • Aspose.Words for Java 20.3 generated output DOCX file showing the undesired behavior (if any)
  • Your expected DOCX file showing the desired output. You can create this document by using MS Word.
  • The JSON data file
  • Please also create a standalone simple Java application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words JAR files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your scenario and provide you more information. Thanks for your cooperation.

Thanks for getting back to me so quickly!
I could resolve the issue: It was a mistake on my part. I had an error in my template, not in my json data.
Sorry for the noise!

@akopp,

It is great that you were able to find what you were looking for. Please let us know any time you have any further queries in future.