Skip to main content

JsonArrayExtensions Class

Abblix.Jwt

Abblix.Jwt

JsonArrayExtensions Class

Conversion helpers between a raw System.Text.Json.Nodes.JsonArray wire form and a sequence of AuthorizationDetail wrappers. Parallels JsonObjectExtensions for object-shaped claims; here the shape is a JSON array and each element is a wrapper over its underlying System.Text.Json.Nodes.JsonNode.

public static class JsonArrayExtensions

Inheritance System.Object → JsonArrayExtensions

Remarks

The raw System.Text.Json.Nodes.JsonArray remains the source of truth — member order and type-specific payload survive the authorize → code → token round-trip byte-exact because no typed deserialise / re-serialise cycle ever runs over the wrapped nodes.

Methods

JsonArrayExtensions.ToRawJsonArray(this IEnumerable<AuthorizationDetail>) Method

Builds a fresh System.Text.Json.Nodes.JsonArray from a sequence of AuthorizationDetail wrappers, deep-cloning each entry's underlying Json so the resulting array is independent of the sources and can attach to a different parent (JSON nodes may have only one parent at a time).

public static System.Text.Json.Nodes.JsonArray? ToRawJsonArray(this System.Collections.Generic.IEnumerable<Abblix.Jwt.AuthorizationDetail>? details);

Parameters

details System.Collections.Generic.IEnumerable<AuthorizationDetail>

The wrapper sequence, or null.

Returns

System.Text.Json.Nodes.JsonArray
A fresh System.Text.Json.Nodes.JsonArray, or null when the input is null.

JsonArrayExtensions.ToTypedArray(this JsonArray) Method

Wraps each non-null element of a raw System.Text.Json.Nodes.JsonArray as an AuthorizationDetail. The wrappers share references with the source array's nodes — read-through is byte-exact, and any property-setter calls mutate the underlying array in place.

public static Abblix.Jwt.AuthorizationDetail[]? ToTypedArray(this System.Text.Json.Nodes.JsonArray? jsonArray);

Parameters

jsonArray System.Text.Json.Nodes.JsonArray

The raw array, or null.

Returns

AuthorizationDetail[]
A wrapper array, or null when the input is null.