Record
public record FlattenedJsonNode : System.ValueType, System.IEquatable<Moka.Blazor.Json.Models.FlattenedJsonNode>

Namespace: Moka.Blazor.Json.Models

A flattened representation of a single JSON node used for virtualized rendering. Each instance represents one visible row in the tree view.

Remarks

This is a readonly record struct to minimize allocations during tree traversal.

Inheritance

Inherits from: System.ValueType

Implements: System.IEquatable<Moka.Blazor.Json.Models.FlattenedJsonNode>

Constructors

NameDescription
FlattenedJsonNode() A flattened representation of a single JSON node used for virtualized rendering. Each instance represents one visible row in the tree view.

FlattenedJsonNode()

FlattenedJsonNode.FlattenedJsonNode()

A flattened representation of a single JSON node used for virtualized rendering. Each instance represents one visible row in the tree view.

Properties

NameDescription
ArrayIndex The index of this element within its parent array, or -1 if not an array element.
ChildCount The number of child elements (for objects: property count, for arrays: element count). Zero for primitive values.
Depth The depth of this node in the tree (root = 0).
HasTrailingComma Whether a comma should be rendered after this node (i.e., it is not the last sibling).
Id Unique identifier for this node within the current document, used for @key directives.
IsActiveSearchMatch Whether this node is the currently active/focused search match.
IsClosingBracket Whether this node is a closing bracket/brace for a collapsed container.
IsExpanded Whether this node is currently expanded (only meaningful for objects and arrays).
IsSearchMatch Whether this node matches the current search query.
Path The JSON Pointer path (RFC 6901) to this node.
PropertyName The property name if this node is an object member; null for array elements or root.
RawValue The raw string representation of the value for primitive types, or null for containers.
ValueKind The kind of JSON value at this node.

ArrayIndex

int FlattenedJsonNode.ArrayIndex { get; init; }

The index of this element within its parent array, or -1 if not an array element.

ChildCount

int FlattenedJsonNode.ChildCount { get; init; }

The number of child elements (for objects: property count, for arrays: element count). Zero for primitive values.

Depth

int FlattenedJsonNode.Depth { get; init; }

The depth of this node in the tree (root = 0).

HasTrailingComma

bool FlattenedJsonNode.HasTrailingComma { get; init; }

Whether a comma should be rendered after this node (i.e., it is not the last sibling).

Id

int FlattenedJsonNode.Id { get; init; }

Unique identifier for this node within the current document, used for @key directives.

IsActiveSearchMatch

bool FlattenedJsonNode.IsActiveSearchMatch { get; init; }

Whether this node is the currently active/focused search match.

IsClosingBracket

bool FlattenedJsonNode.IsClosingBracket { get; init; }

Whether this node is a closing bracket/brace for a collapsed container.

IsExpanded

bool FlattenedJsonNode.IsExpanded { get; init; }

Whether this node is currently expanded (only meaningful for objects and arrays).

IsSearchMatch

bool FlattenedJsonNode.IsSearchMatch { get; init; }

Whether this node matches the current search query.

Path

string FlattenedJsonNode.Path { get; init; }

The JSON Pointer path (RFC 6901) to this node.

PropertyName

string? FlattenedJsonNode.PropertyName { get; init; }

The property name if this node is an object member; null for array elements or root.

RawValue

string? FlattenedJsonNode.RawValue { get; init; }

The raw string representation of the value for primitive types, or null for containers.

ValueKind

JsonValueKind FlattenedJsonNode.ValueKind { get; init; }

The kind of JSON value at this node.

Type Relationships
classDiagram
                    style FlattenedJsonNode fill:#f9f,stroke:#333,stroke-width:2px
                    FlattenedJsonNode --|> ValueType : inherits
                    FlattenedJsonNode ..|> FlattenedJsonNode~ : implements
                
View Source
/// <summary>
///     A flattened representation of a single JSON node used for virtualized rendering.
///     Each instance represents one visible row in the tree view.
/// </summary>
/// <remarks>
///     This is a readonly record struct to minimize allocations during tree traversal.
/// </remarks>
public readonly record struct FlattenedJsonNode()
{
    /// <summary>
    ///     Unique identifier for this node within the current document, used for <c>@key</c> directives.
    /// </summary>
    public required int Id { get; init; }
    /// <summary>
    ///     The JSON Pointer path (RFC 6901) to this node.
    /// </summary>
    public required string Path { get; init; }
    /// <summary>
    ///     The depth of this node in the tree (root = 0).
    /// </summary>
    public required int Depth { get; init; }
    /// <summary>
    ///     The property name if this node is an object member; <c>null</c> for array elements or root.
    /// </summary>
    public string? PropertyName { get; init; }
    /// <summary>
    ///     The kind of JSON value at this node.
    /// </summary>
    public required JsonValueKind ValueKind { get; init; }
    /// <summary>
    ///     The raw string representation of the value for primitive types, or <c>null</c> for containers.
    /// </summary>
    public string? RawValue { get; init; }
    /// <summary>
    ///     The number of child elements (for objects: property count, for arrays: element count).
    ///     Zero for primitive values.
    /// </summary>
    public required int ChildCount { get; init; }
    /// <summary>
    ///     The index of this element within its parent array, or <c>-1</c> if not an array element.
    /// </summary>
    public int ArrayIndex { get; init; } = -1;
    /// <summary>
    ///     Whether this node is currently expanded (only meaningful for objects and arrays).
    /// </summary>
    public required bool IsExpanded { get; init; }
    /// <summary>
    ///     Whether this node is a closing bracket/brace for a collapsed container.
    /// </summary>
    public bool IsClosingBracket { get; init; }
    /// <summary>
    ///     Whether this node matches the current search query.
    /// </summary>
    public bool IsSearchMatch { get; init; }
    /// <summary>
    ///     Whether this node is the currently active/focused search match.
    /// </summary>
    public bool IsActiveSearchMatch { get; init; }
    /// <summary>
    ///     Whether a comma should be rendered after this node (i.e., it is not the last sibling).
    /// </summary>
    public required bool HasTrailingComma { get; init; }
}
Was this page helpful?