Class JsonExpression<Type>

Source
Expand description

Class for creating JSON-based n8n expressions with type safety. Allows combining static JSON data with ExpressionBuilder instances to create complex n8n expressions.

Constructors§

Source§

new JsonExpression<Type = any>(
    data: Type,
): JsonExpression<Type>

Properties§

Source§

infer: Type = ...

Only used to infer the type of the data

Methods§

Source§

from<const T>(
    data: T,
): JsonExpression<Writeable<InferJsonExpression<T>>>

Factory method to create a JsonExpression with proper type inference. Recursively infers types from nested ExpressionBuilder instances.

Source§

toExpression(
    options?: {
        indent?: number;
        removeCurly?: boolean;
        removeEquals?: boolean;
        withPrefix?: boolean;
    },
): string

Converts the JsonExpression to an n8n expression string. Serializes the data to JSON and processes special markers to inject expressions.