DashboardJsonDataSource Class

A data source that retrieves data stored in JSON format.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v21.2.Core.dll


public class DashboardJsonDataSource :


The DashboardJsonDataSource allows you to extract JSON data from a Web-service endpoint URI, text file, or a string in JSON format.


The DashboardJsonDataSource object requires the open source Newtonsoft.Json library. Install the Newtonsoft.Json NuGet package in Visual Studio.

Use the AccessSettings class to explicitly allow the path to the data file. To accomplish this, configure rules in the DataResources property to restrict file system access to the specified folders. You can call the SetRules(IAccessRule[]) method when the application starts to specify rules before a dashboard control sets its rules. The SetRules(IAccessRule[]) method can be called only once at the application startup. Otherwise, the method will raise an exception. Alternatively, you can use the TrySetRules(IAccessRule[]) method, which does not raise an exception.

Design Time

Follow the step-by-step instruction How to create JSON Data Source at design time.


  1. Create the DashboardJsonDataSource instance with a simple constructor.
  2. Use the JsonSource property to specify the JSON data location.
  3. Use the RootElement property to specify a root JSON node.
  4. Add the created data source to the dashboard’s Dashboard.DataSources collection.
  5. Assign the created data source to the dashboard item’s DataDashboardItem.DataSource property.

View Example: How to Bind a Dashboard to the JSON Data Source at Runtime

The code sample below illustrates how to retrieve JSON data from different sources:

using DevExpress.DashboardCommon;
using DevExpress.DataAccess.Json;
// ...
public void InitializeDashboard() {
    Dashboard dashboard = new Dashboard();
    DashboardJsonDataSource jsonDataSourceFromWeb = CreateJsonDataSourceFromWeb();
    DashboardJsonDataSource jsonDataSourceFromFile = CreateJsonDataSourceFromFile();
    DashboardJsonDataSource jsonDataSourceFromString = CreateJsonDataSourceFromString();


public static DashboardJsonDataSource CreateJsonDataSourceFromWeb()
    var jsonDataSource = new DashboardJsonDataSource();
    jsonDataSource.JsonSource = new UriJsonSource(new Uri("https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json"));
    jsonDataSource.RootElement = "Customers";
    return jsonDataSource;

public static DashboardJsonDataSource CreateJsonDataSourceFromFile()
    var jsonDataSource = new DashboardJsonDataSource();
    Uri fileUri = new Uri("customers.json", UriKind.RelativeOrAbsolute);
    jsonDataSource.JsonSource = new UriJsonSource(fileUri);
    jsonDataSource.RootElement = "Customers";
    return jsonDataSource;

public static DashboardJsonDataSource CreateJsonDataSourceFromString()
  var jsonDataSource = new DashboardJsonDataSource();
  string json = "{\"Customers\":[{\"Id\":\"ALFKI\",
  \"CompanyName\":\"Alfreds Futterkiste\",\"ContactName\":\"Maria Anders\",
  \"ContactTitle\":\"Sales Representative\",\"Address\":\"Obere Str. 57\",
  jsonDataSource.JsonSource = new CustomJsonSource(json);
  jsonDataSource.RootElement = "Customers";
  return jsonDataSource;

The following code snippets (auto-collected from DevExpress Examples) contain references to the DashboardJsonDataSource class.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also