Table of Contents

Class SystemTextJsonFacts

Namespace
RuleWright.Json.SystemText
Assembly
RuleWright.Json.SystemText.dll

Helpers for using JSON payloads as dynamic facts: converts a JsonElement into the IDictionary<string, object> shape the engine's interpreter evaluates (reported as Interpreted).

public static class SystemTextJsonFacts
Inheritance
SystemTextJsonFacts
Inherited Members

Methods

ToDictionary(JsonElement)

Recursively converts a JSON object into a dictionary fact. Nested objects become nested dictionaries; arrays become object?[]; numbers become long when integral, otherwise decimal when exactly representable, otherwise double. Keys match exactly (ordinal, case-sensitive); to match field paths without regard to case, use ToDictionary(JsonElement, IEqualityComparer<string>).

ToDictionary(JsonElement, IEqualityComparer<string>)

Recursively converts a JSON object into a dictionary fact whose keys, at every level, compare with keyComparer. The interpreter looks each field-path segment up through the dictionary's own comparer, so with OrdinalIgnoreCase a rule reading Order.Total finds a camelCase payload's order.total, just as a typed fact's members already match. Values convert exactly as in ToDictionary(JsonElement).