Skip to main content
A newer version of this page is available. .

UriJsonSource.Uri Property

Gets or sets the System.Uri object that points to a URI or text file with JSON data.

Namespace: DevExpress.DataAccess.Json

Assembly: DevExpress.DataAccess.v20.1.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.WindowsDesktop.DataAccess

Declaration

[DefaultValue(null)]
public Uri Uri { get; set; }

Property Value

Type Default Description
Uri *null*

Points to a Web-service endpoint or text file with JSON data.

Remarks

The following example demonstrates how to associate the JsonDataSource object with data from a web-service endpoint.

using DevExpress.DataAccess.Json;
// ...
public static JsonDataSource CreateDataSourceFromWeb() {
    var jsonDataSource = new JsonDataSource();
    // Specify the endpoint.
    jsonDataSource.JsonSource = new UriJsonSource(new Uri("http://northwind.servicestack.net/customers.json"));
    // Populate the data source with data.
    jsonDataSource.Fill();
    return jsonDataSource;
}

The following example demonstrates how to associate the JsonDataSource object with JSON data from a file.

using DevExpress.DataAccess.Json;
// ...
public static JsonDataSource CreateDataSourceFromFile() {
    var jsonDataSource = new JsonDataSource();
    // Specify the JSON file name.
    Uri fileUri = new Uri("customers.json", UriKind.RelativeOrAbsolute);
    jsonDataSource.JsonSource = new UriJsonSource(fileUri);
    // Populate the data source with data.
    jsonDataSource.Fill();
    return jsonDataSource;
}
See Also