Bind a Report to JSON Data
- 2 minutes to read
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).
Add a new blank report to your application.
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…
This invokes the Data Source Wizard.
Choose the JSON option and click Next.
Note
The End-User Report Designer‘s Report Wizard provides the JSON option if the application references the open-source Newtonsoft.Json library.
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.
On the next page, the wizard shows the specified JSON data’s structure. You can choose all nodes or a subset of nodes.
Uncheck the data fields that your report does not require.
You can rename data fields if necessary.
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.
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.
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.