Skip to main content
All docs
V24.2

JSON Data - Change Data Source at Runtime

When a JSON data source is already registered in the End-User Report Designer in ASP.NET Core Applications, you cannot change the data source’s JsonSource property to load data from another endpoint: the data may already be loaded and cached. To specify a new JSON source, implement the IJsonSourceCustomizationService interface.

using DevExpress.XtraPrinting.Native;

// ...
XtraReport1 report = new XtraReport1();
report.ReplaceService<IJsonSourceCustomizationService>(new MyJsonCustomizationService()); 
report.CreateDocument();

public class MyJsonCustomizationService : IJsonSourceCustomizationService  
{  
    public JsonSourceBase CustomizeJsonSource(JsonDataSource jsonDataSource)  
    {  
        return new DevExpress.DataAccess.Json.UriJsonSource("https://northwind.netcore.io/customers.json"));  
    }  
}