Class JsonPathExpression

Assembly: redb.Route.dll

Expression for evaluating JSONPath (RFC 9535, JsonPath.Net) queries against the message body.

public class JsonPathExpression : Expression, IExpression

Inheritance

Object→Expression→JsonPathExpression

Implements

Inherited Members

Properties

Path

The JSONPath text.

public string Path { get; }

Methods

Evaluate<T>(IExchange)

Evaluates the expression and returns the result cast to T.

public override T Evaluate<T>(IExchange exchange)

From(IExpression)

Returns the same expression reading source instead of the message body.

public JsonPathExpression From(IExpression source)

SetValue(IExchange, object)

Sets a value in the exchange according to this expression's semantics.

public override void SetValue(IExchange exchange, object value)

ToTemplateString()

Serializes this expression to a ${...} template string suitable for URI parameters.

public override string ToTemplateString()

Constructors

JsonPathExpression(string, IExpression?)

Initializes a new instance of the class.

Remarks

Accepts JSON text, byte[], , a System.Text.Json tree (,
, ) or a POCO (serialized with its C# member names).
JSON text may contain comments and trailing commas. Results convert to the requested type the way
they always did: a scalar to T, an array to a typed CLR array / list, an object
to a POCO or dictionary, anything to string as its text (compact JSON for arrays and objects,
invariant culture for numbers). Dates stay strings unless a is asked for.