Reporting - New JSON and XPO Data Sources (v18.2)

01 November 2018

Reports are almost always bound to data – the more flexible our Reporting solution is when it comes to supported data sources, the more use cases we can cover. For v18.2 we added two new data source types that you can choose in the Data Source Wizard of the Report Designer.

New Data Source Types

The JSON Data Source and the XPO Data Source are new in this release. Like other data source types, they are handled directly by the Reporting system. The Wizard creates components to represent the data sources and accommodate some settings, and these components are persisted and restored together with the layout and design information of a report. The names of the new components are JsonDataSource and XPObjectSource.

JSON Data in Reports

JSON is a simple text-based format that is directly compatible with JavaScript (hence the name JavaScript Object Notation - JSON), but in other languages you need to deserialize objects from JSON format to native types. The JsonDataSource does this job for you, but of course it needs to know where the data comes from. The first page of the Wizard allows you to specify a Web Service Endpoint URI, a filename or even a string with JSON content:

Choose the source of JSON data

For the next step, the Wizard analyzes the JSON data and shows the structure in a hierarchy. You can choose all nodes or a subset of them to define which parts of the JSON will be used as data for the report.

Schema of JSON data

It is possible to change the type of the JsonDataSource as well as the schema. Once the component comes up in the Field List tool window, right-click it and choose the items Edit… and Edit Schema… from the context menu to make changes.

Note that we use the Open Source library Newtonsoft.Json for our implementation. This library is the de-facto standard for JSON in .NET. The wizard detects whether your project already references it and suggests to install the required NuGet package if necessary.

Installing Newtonsoft.Json

JSON Data Access from Code

If you would like to set up access to JSON data from code, use the specific types depending on the source of your data. For instance, to access data from a web service:

using DevExpress.DataAccess.Json;


var dataSource = new JsonDataSource();
ds.JsonSource = new UriJsonSource(new Uri("https://..."));

XtraReport report = ...;
report.DataSource = dataSource;

As a side note, the JsonDataSource is not limited to Reporting. Continuing from the sample code above, you can also use it for a Data Grid, for instance:

myDataGrid.DataSource = dataSource;

A Limitation

In this initial implementation of the JsonDataSource, we do not support token-based authentication. We are interested in your feedback – do you require this authentication support?

Access to XPO Data

eXpress Persistent Objects (XPO) is our own ORM product. You can find more information about it here if you’re curious. To work with XPO data in your own project you need to add persistent types, for instance using the XPO Data Model Wizard or a project item template.

If you select the XPO Data Source type in the Report Data Source Wizard, the next page will show the XPO persistent types that have been found in your project. (Note that you may need to build your solution in case the list doesn’t show all the types you expected!)

Choose an XPO entity

Once you have selected the XPO persistent type for your report, the further process is similar to the one described in our tutorial Bind a Report to a Database. You need to specify connection settings and then start to design your report.

The XPObjectSource component created by the Data Source Wizard is a standard XPO binding component. It has several properties you may want to configure, for example for server-side filtering of the queried data.

XPObjectSource settings

A cool XPO feature is the support for server-side calculated properties. You can add new properties in the editor for the Properties collection on the XPObjectSource and define PropertyExpressions for them.

XPO Properties collection editor

Your Feedback is Valuable!

We would like to hear what you think about these new features. Of course you can leave comments below or get back to us in the Support Center, but we would very much appreciate your responses to this quick survey:

14 comment(s)
Alfred Rakgole 2

Great news on JSON datasource Oliver!

The JsonDataSource across anything that takes a datasource will be even better

(e.g. dashboards, charts, grids....etc), but this a great news.

Well done.

1 November, 2018

Is there a documentation about JsonDataSource already? This feature is great. Will simplify many tasks.

1 November, 2018
Tammy Busby

Amazing... This is fantastic news..

1 November, 2018
cedrus bank

All my XtraReports are bound to XPCollections.

What makes the XpoObjectSource different from the XPCollection ?

1 November, 2018
Kiryl Y.

Good question, Cedrus

1 November, 2018
Dennis (DevExpress Support)

@Cedrus Bank, Kiryl Y.:

If you are happy with XPCollection or XPView and bind them only at runtime, there will be not much difference for you. Your approach will be supported further and you can keep using it.

We primarily designed XPObjectSource for the following:

- Full end-user report designer support. You will no longer have serialization issues sharing REPX bound to XPCollection or XView between users.

- Reduce the amount of code to bind reports with XPO data (check  E1845 | E3169 to compare the former approach with the new one).

- Provide additional features such as server-side calculated properties (including aggregates for associated collections), grouping support, for which you would need to use different components or write extra code before.

Let us know in case of any questions.

2 November, 2018
Dmitry Tok (DevExpress Support)

@Alfred: While JsonDataSource is integrated only into the Report Wizard, you can also use it for the other components at runtime. Feel free to create a support ticket if you see any issue with this.

@Gosha: Not yet, we'll publish the documentation once v18.2 is released.

2 November, 2018
Alfred Rakgole 2

Hi Dmitry,

Any chance the Web Designer Report designer will have similar sources in the

Data Source Wizard? I.e. Json, Xpo...etc.

If not, will the report created in the winforms report designer hooked to jsondatasource

render in the Document Viewer?

4 November, 2018
Daniel Rottschäfer

I love to hear about the JsonDataSource Feature (Web Service Endpoint URI).

For me, the feature is useless at the moment, because I need bearer token authentication.

5 November, 2018
Hedi Guizani

Is xposource available for dashboards

5 November, 2018
Dmitry Tok (DevExpress Support)

@Alfred: We plan to incorporate these types of data sources into the Data Source Wizard of the Web Report Designer. However, results of the future release cycle planning and prioritization of tasks directly depend on a customer's demand, so I can't promise anything specific right now. Which of these data sources would you like to see in the Web Data Source Wizard most?

-->If not, will the report created in the winforms report designer hooked to jsondatasource render in the Document Viewer?


@Daniel: Thanks for your vote on this!

@Hedi: You can bind a dashboard to XPO data using the ObjectDataSource component. Feel free to contact our support team if you need technical assistance.

5 November, 2018
Alfred Rakgole 2

Hi Dmitry,

"Which of these data sources would you like to see in the Web Data Source Wizard most?"

(1) JSON

(2) Excel

similar to how these works in winforms


16 December, 2018
Eric Claiborne - Knox

I am building a greenfield application using .Net Core MVC with DevExpress.  The reporting part of this new ERP app will use a JSON API so JSON as a Data Source is great news!  However, my entire API is secured by a JSON Web Token (JWT), therefore, I would really need to have the XtraReport to be able to pass in the JWT in order to get the data to return.  Else it will fail.  Thanks!

14 May, 2019
Dmitry Tok (DevExpress Support)

Hi Eric,

We enhanced JSON Data Source and it supports several authentication settings starting with v19.1. You can find details in this blog post: JsonDataSource Updates.

15 May, 2019

Please login or register to post comments.