Back to Devexpress

JsonNode Class

corelibraries-devexpress-dot-dataaccess-dot-json-6c3dee84.md

latest3.0 KB
Original Source

JsonNode Class

Defines a node in the JsonDataSource‘s schema.

Namespace : DevExpress.DataAccess.Json

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
public class JsonNode
vb
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.

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

Inheritance

Object JsonNode

See Also

JsonNode Members

DevExpress.DataAccess.Json Namespace