Skip to main content

CustomJsonSource.Json Property

Gets or sets a string with JSON data.

Namespace: DevExpress.DataAccess.Json

Assembly: DevExpress.DataAccess.v24.1.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap

Declaration

[TypeConverter("DevExpress.DataAccess.UI.Native.NoConvertableFromStringConverter,DevExpress.DataAccess.v24.1.UI, Version=24.1.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
public string Json { get; set; }

Property Value

Type Description
String

A string with JSON data.

Remarks

The following example demonstrates how to populate a JSON data source with data from a string variable.

using DevExpress.DataAccess.Json;
using DevExpress.XtraReports.UI;
// ...
public static JsonDataSource CreateDataSourceFromText() {
    var jsonDataSource = new JsonDataSource();

    // Specify a string with JSON data.
    string json = "{\"Customers\":[{\"Id\":\"ALFKI\",\"CompanyName\":\"Alfreds Futterkiste\"," +
        "\"ContactName\":\"Maria Anders\",\"ContactTitle\":\"Sales Representative\"," +
        "\"Address\":\"Obere Str. 57\",\"City\":\"Berlin\",\"PostalCode\":\"12209\"," +
        "\"Country\":\"Germany\",\"Phone\":\"030-0074321\",\"Fax\":\"030-0076545\"}]," +
        "\"ResponseStatus\":{}}";

    // Specify the object that retrieves JSON data.
    jsonDataSource.JsonSource = new CustomJsonSource(json);
    // Populate the data source with data.
    jsonDataSource.Fill();
    return jsonDataSource;
}
See Also