com.aspose.words

Class JsonDataSource

  • java.lang.Object
    • com.aspose.words.JsonDataSource
public class JsonDataSource 
extends java.lang.Object

Provides access to data of a JSON file or stream to be used within a report.

To access data of the corresponding file or stream while generating a report, pass an instance of this class as a data source to one of ReportingEngine.buildReport overloads.

In template documents, if a top-level JSON element is an array, a JsonDataSource instance should be treated in the same way as if it was a com.aspose.words.net.System.Data.DataTable instance. If a top-level JSON element is an object, a JsonDataSource instance should be treated in the same way as if it was a com.aspose.words.net.System.Data.DataRow instance. For more information, see template syntax reference (https://docs.aspose.com/display/wordsjava/Template+Syntax).

In template documents, you can work with typed values of JSON elements. For convenience, the engine replaces the set of simple JSON types with the following one:

  • java.lang.Integer
  • java.lang.Long
  • java.lang.Double
  • java.lang.Boolean
  • java.util.Date
  • java.lang.String

The engine automatically recognizes values of the extra types upon their JSON representations.

Constructor Summary
JsonDataSource(java.lang.StringjsonPath)
Creates a new data source with data from a JSON file.
 

    • Constructor Detail

      • JsonDataSource

        public JsonDataSource(java.lang.String jsonPath)
                       throws java.lang.Exception
        Creates a new data source with data from a JSON file.
        Parameters:
        jsonPath - The path to the JSON file to be used as the data source.