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 JsonArrayExtensionsInheritance 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.
Remarks
The attribute states one half of the sentence above in the type system: never null out for an input that was not. The other half, null in null out, is not expressible there and is pinned by a test instead.
Without it a caller holding a non-null array still gets a nullable result, and the way that gets silenced is a null-forgiving operator - which keeps compiling after the guard it depends on is moved or deleted, asserting something no longer true. With it the compiler carries the claim and re-checks it at every call site.