corelibraries-devexpress-dot-dataaccess-dot-json-d9a0f6f0.md
Defines a node and its hierarchy in the JsonDataSource‘s schema.
Namespace : DevExpress.DataAccess.Json
Assembly : DevExpress.DataAccess.v25.2.dll
NuGet Package : DevExpress.DataAccess
public class JsonSchemaNode :
Node<JsonNode>,
INotifyPropertyChanged
Public Class JsonSchemaNode
Inherits Node(Of JsonNode)
Implements INotifyPropertyChanged
The following members return JsonSchemaNode objects:
| Library | Related API Members |
|---|---|
| Cross-Platform Class Library | DataSourceModel.JsonSchema |
| IJsonDataSourceModel.JsonSchema | |
| JsonDataSource.LoadSchema(Type) | |
| JsonDataSource.Schema | |
| JsonDataSourceModel.JsonSchema | |
| .NET Reporting Tools | XtraReportModel.JsonSchema |
A JsonDataSource‘s schema is a JsonSchemaNode class instance that represents the schema’s root node. The root node’s JsonSchemaNode.Children property contains a collection of JsonSchemaNode class instances that represent child nodes.
The following properties specify a schema node:
You can specify a hierarchy of JsonSchemaNode in the JsonDataSource.Schema collection before you call the JsonDataSource.Fill method. If you do not specify the schema, JsonDataSource.Fill creates the data source schema and populates the data source with the data.
Note
Set JsonDataSource.Schema to null before you call JsonDataSource.Fill to discard the previous schema changes.
The code sample below defines the JSON data source schema that consists of the Customer ID and CompanyName fields.
using DevExpress.DataAccess.Json;
// ...
// Define the data source schema.
var root = new JsonSchemaNode();
root.NodeType = JsonNodeType.Object;
var customers = new JsonSchemaNode() { NodeType=JsonNodeType.Array, Name="Customers", Selected=true};
customers.AddChildren(new[] {
new JsonSchemaNode(new JsonNode("ID", true, JsonNodeType.Property, typeof(string))) { DisplayName="Customer ID"},
new JsonSchemaNode() { Name="CompanyName", Selected=true, NodeType=JsonNodeType.Property, Type=typeof(string)},
});
root.AddChildren(customers);
Imports DevExpress.DataAccess.Json
' ...
' Define the data source schema.
Dim root = New JsonSchemaNode()
root.NodeType = JsonNodeType.Object
Dim customers = New JsonSchemaNode() With {.NodeType = JsonNodeType.Array, .Name = "Customers", .Selected = True}
customers.AddChildren({
New JsonSchemaNode(New JsonNode("ID", True, JsonNodeType.Property, GetType(String))) With {.DisplayName = "Customer ID"},
New JsonSchemaNode() With {.Name = "CompanyName", .Selected = True, .NodeType = JsonNodeType.Property, .Type = GetType(String)}
})
root.AddChildren(customers)
Object Node<JsonNode> JsonSchemaNode
See Also