Path: redb-route/redb.Route/Expressions/TypedJsonPathExpression.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Expressions/TypedJsonPathExpression.cs ---- using redb.Route.Abstractions; namespace redb.Route.Expressions; /// /// A JsonPath expression that remembers the target CLR type . /// When the pipeline calls Evaluate<object>(exchange), the stored type is used /// for the internal call, ensuring proper /// type conversion (e.g., jpath<bool>("$.isHired") returns a boxed /// instead of a raw ). /// /// The target CLR type for JsonPath result conversion. public sealed class TypedJsonPathExpression : Expression { private readonly JsonPathExpression _inner; private readonly string _path; /// /// Initializes a new instance of the class. /// /// The JsonPath expression string. /// What to run the path against; null means the message body. public TypedJsonPathExpression(string jsonPath, IExpression? source = null) { _path = jsonPath; _inner = new JsonPathExpression(jsonPath, source); } /// public TypedJsonPathExpression From(IExpression source) => new(_path, source); /// public override T Evaluate(IExchange exchange) { // When the processor asks for Evaluate, we evaluate with the stored TValue // so that JsonPathExpression performs proper type conversion. if (typeof(T) == typeof(object)) { var typed = _inner.Evaluate(exchange); return (T)(object)typed!; } // If the caller requests a specific type, forward directly return _inner.Evaluate(exchange); } /// public override void SetValue(IExchange exchange, object value) { _inner.SetValue(exchange, value); } }