corelibraries-devexpress-dot-dataaccess-dot-json-dot-jsondatasource-a88a2ebd.md
Populates the JsonDataSource object with JSON data.
Namespace : DevExpress.DataAccess.Json
Assembly : DevExpress.DataAccess.v25.2.dll
NuGet Package : DevExpress.DataAccess
public void Fill()
Public Sub Fill
Use the Fill method to populate the JsonDataSource with data.
If you did not define the data source schema, the data source is populated with all data available from the source.
The JsonDataSourceException exception occurs if the Fill method failed to populate the data source. Catch this exception or handle the FillError event to ensure that the Fill method has completed successfully.
The code sample below creates a JSON data source and populates it with data from the endpoint.
using DevExpress.DataAccess.Json;
// ...
// Create a new JSON data source and populate it with data.
var jsonDataSource = new JsonDataSource();
jsonDataSource.JsonSource = new UriJsonSource() {
Uri = new Uri(@"https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json")
};
jsonDataSource.Fill();
Imports DevExpress.DataAccess.Json
' ...
' Create a new JSON data source and populate it with data.
Dim jsonDataSource = New JsonDataSource()
jsonDataSource.JsonSource = New UriJsonSource() With {.Uri = New Uri("https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json")}
jsonDataSource.Fill()
The following code snippets (auto-collected from DevExpress Examples) contain references to the Fill() method.
Note
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.
winforms-dashboard-json-data-source/CS/DashboardJsonExample/Form1.cs#L52
jsonDataSource.RootElement = "Customers";
jsonDataSource.Fill();
return jsonDataSource;
reporting-winforms-provide-authentication-to-access-json-data/CS/Form1.cs#L26
// Retrieve data to populate the Report Designer's Field List
jsonDataSource.Fill();
reporting-winforms-create-report-bound-to-json-data-source/CS/Form1.cs#L102
// Populate the data source with data.
jsonDataSource.Fill();
return jsonDataSource;
data-access-library-create-data-sources-at-runtime/CS/JsonDataSourceSnippets/Code.cs#L16
jsonDataSource.JsonSource = new DevExpress.DataAccess.Json.UriJsonSource(sourceUri);
jsonDataSource.Fill();
}
reporting-web-forms-report-designer-add-data-sources/CS/WebApplication1/Default.aspx.cs#L31
jsonDataSource.JsonSource = new DevExpress.DataAccess.Json.UriJsonSource(uri);
jsonDataSource.Fill();
return jsonDataSource;
winforms-dashboard-json-data-source/VB/DashboardJsonExample/Form1.vb#L49
jsonDataSource.RootElement = "Customers"
jsonDataSource.Fill()
Return jsonDataSource
reporting-winforms-provide-authentication-to-access-json-data/VB/Form1.vb#L27
' Retrieve data to populate the Report Designer's Field List
jsonDataSource.Fill()
reporting-winforms-create-report-bound-to-json-data-source/VB/Form1.vb#L89
' Populate the data source with data.
jsonDataSource.Fill()
Return jsonDataSource
data-access-library-create-data-sources-at-runtime/VB/JsonDataSourceSnippets/Code.vb#L13
jsonDataSource.JsonSource = New DevExpress.DataAccess.Json.UriJsonSource(sourceUri)
jsonDataSource.Fill()
End Sub
reporting-web-forms-report-designer-add-data-sources/VB/WebApplication1/Default.aspx.vb#L31
jsonDataSource.JsonSource = New DevExpress.DataAccess.Json.UriJsonSource(sourceUri)
jsonDataSource.Fill()
Return jsonDataSource
See Also