To set up a JSON connection to connect a JReport catalog to a JSON data source, follow the steps below:
If you want to set up the connection by adding a data source to an existing catalog and then defining the connection on the data source, open the catalog, select any data source contained in it, click the New Data Source button
on the Catalog Browser toolbar, then in the New Data source dialog, specify the name of the data source, select the JSON connection type and click OK.
The JSON Connection Wizard appears.
If the file is from a remote URI, click RESTful to specify the RESTful data options for the sample data in the RESTful Data Source Options dialog. See the dialog.
To add a header line, click
, and if a header is not required, select it and click
to remove it. If needed, click
to create a parameter for use. You can also click the Edit Format button to define the format of the values referenced in the HTTP headers or body.
You can use parameters or constant level formulas predefined in the current catalog data source or the special field User Name in the URI or parameter string, and the format of the predefined parameters used in the string is "@" + parameter name. For example, if the parameter string of a class is SQL=select * from employee, and you want to use the parameter sql in a catalog to replace the part after "=" in the string, then the parameter string of the class will be SQL=@sql. Moreover, if a parameter string contains characters, such as @, '.' or double quotation marks, or other strings that do not need to be parsed, quote the whole string with double quotation marks. If the special field User Name is used, when clicking Next, the Security Identifier dialog will pop up for you to specify the security ID (SID), which refers to the user name, used to generate the JSON schema. While, at runtime, you can go to the General category of the Options dialog by clicking File > Options on the menu bar to set the User Name option. You can also click the Edit Format button to edit the format of the referenced values.
When done, click Next to go to the next screen.