Skip to main content

JsonNode Class

Defines a node in the JsonDataSource‘s schema.

Namespace: DevExpress.DataAccess.Json

Assembly: DevExpress.DataAccess.v24.2.dll

NuGet Package: DevExpress.DataAccess

#Declaration

public class JsonNode

#Remarks

Use the JsonSchemaNode.Value property to access a JsonNode class instance and its members.

The following properties specify a JSON schema node:

  • Name - the node name.
  • DisplayName - the node’s display name.
  • Type - the data source field type.
  • NodeType - specifies if the node is an array, object, or property.
  • Selected - specifies whether to include the node in the JSON schema.

#Example

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);

#Inheritance

Object
JsonNode
See Also