hallo awais,
thank you for your response.
There are two problems with the solution:
First: I have to change the structure of the input data. Do I always need to change the structure of the JSON Object in order to access first element of array?
Second: You use “foreach” and it means it will print multiple values, if activities has more than 1 element, but I need only one element from array.
What I have tried:
<<[activities[0]]>> - does not work
<<foreach [t in activities]>><<[t.IndexOf()==0? t_Text:""]>><> - does not work
Please check these two relevant quotes from documentation (Accessing JSON Data):
If a root JSON element is an array, a JsonDataSource instance should be treated as a sequence of items of this array. Although this statement relates to a root JSON element, in fact, all JSON arrays are treated the same: They are loaded as sequences of array items. So array operations become unavailable. However, all sequential operations are available, so a LINQ extension method such as First() can be used instead.
To reference a JSON object property that is an array of simple-type values, the name of the property (for example, “Child”) should be used in a template document, whereas the same name with the “_Text” suffix (for example, “Child_Text”) should be used to reference the value of an item of this array.
Combining these all together, please use the following template syntax for your use case:
Thank you for your support, it works now!!!
As I am not from C# world, could you please point me to the official MS documentation on sequences?(btw. what class is that?) That would help me with further questions regarding available methods.
LINQ Reporting Engine of ‘Aspose.Words for Java’ does not use .NET LINQ internally. The engine mimics .NET LINQ to provide similar capabilities for template syntax. The subset of LINQ extension methods supported by the engine in Java can be found in the following page: