The requested page is not available for the requested platform. You are viewing the content for Default platform.

Bind a Report to JSON Data

This topic describes how to bind a report to JSON data at design time.

Create a Project and Prepare a Data Source

To get started with this tutorial, open an existing reporting application or create a new application (the Add a Report to Your .NET Application section explains how to create a reporting application on different platforms).

  1. Add a new blank report to your application.

  2. Click the report's smart tag. In the invoked actions list, expand the drop-down menu for the DataSource property and click Add Report Data Source...

    how-to-ef-datasource01

    This invokes the Data Source Wizard.

  3. Choose the JSON option and click Next.

    JSON-SelectJSONDataSource

    Note

    The End-User Report Designer's Report Wizard provides the JSON option if the application references the open-source Newtonsoft.Json library.

  4. The next wizard page allows you to specify a Web Service Endpoint URI, a filename or a string with JSON content.

    Note

    DevExpress Reporting uses the open-source Newtonsoft.Json library to provide JSON data at runtime. The wizard detects whether your project references this library and suggests to install the required NuGet package if necessary.

    JSON-Newtonsoft

    If you choose the Web Service Endpoint option, you can configure a connection string on the next wizard pages.

    4.1. Specify request parameters.

    JSON-specify-request-parameters

    Tip

    Specify the Basic HTTP Authentication parameters or header parameters to access JSON data.

    4.2. Choose whether to save the created connection string to the application's configuration file. If not, the connection parameters are saved to the report's definition.

    JSON-save-connection-string

    Tip

    If the request parameters you specified on the previous page do not contain sensitive data, you can save them along with the connection parameters. Otherwise, the specified request parameters are used once to retrieve JSON data to an object in memory. This object is accessible until you close the Report Designer.

  5. On the next page, the wizard shows the specified JSON data's structure. You can choose all nodes or a subset of nodes.

    JSON-SelectRootElement

    Uncheck the data fields that your report does not require.

    You can rename data fields if necessary.

    JSON-EditFieldNames

After you finish the wizard, it creates the JsonDataSource component. This component retrieves the checked data fields that the selected JSON element includes. The Field List reflects the data source structure.

JSON-FieldList

Customize the JSON Data Source

Right-click the JsonDataSource component in the Field List or Report Explorer and choose Edit.... Specify another JSON data location and reconfigure data fields in the invoked wizard.

JSON-FieldList

Customize the JSON Data Source Schema

Right-click the JsonDataSource component in the Report Explorer and choose Edit Schema.... Reconfigure data fields in the invoked wizard page.

JSON-EditSchema

See Also