Conigma Connect
Expressions
Introduction
Expressions are an integral part of Connect and are used extensively to add flexibility and logic to flows. They provide a compact, text-based way of describing operations that would otherwise require multiple nested instruction blocks. This makes flows easier to design and maintain, while still supporting complex processing requirements.
The expression language is primarily based on C# expression syntax, making it familiar to most developers. In nearly all cases, basic knowledge of writing typical programming expressions is enough to work effectively.
Expressions can be placed wherever a data source is expected, allowing them to generate values, transform inputs, or directly construct data structures.
They are always evaluated within a defined context, and JSON paths can be used inside them to access values stored in that context.
The capabilities range from standard operators such as +, -, *, /, <, >, =, and != to more complex manipulations. For example, arrays can be modified and strings can be concatenated directly. Helper functions extend the language further, enabling many common integration tasks to be handled within a single expression.
The following section provides a detailed description of the advanced syntax, available operators, and predefined helper functions.
Binary Operators
A binary expression represents an operation between two values, such as arithmetic or comparison. Both sides of the operator can be literals, JSON paths, or nested expressions in parentheses.
Arithmetic | Description | Result |
|---|---|---|
1 + 2 | Addition | 3 |
5 - 3 | Subtraction | 2 |
4 * 2 | Multiplication | 8 |
8 / 2 | Division | 4 |
7 % 3 | Modulo | 1 |
1 << 3 | Bit shift left | 8 |
8 >> 2 | Bit shift right | 2 |
(1 + 2) * 3 | Grouping with () | 9 |
Logical | Description | Result |
|---|---|---|
true || false | Logical OR | true |
true && false | Logical AND | false |
1 < 2 && 2 < 3 | Chained check | true |
Comparison | Description | Result |
|---|---|---|
5 == 5 | Equality | true |
5 != 3 | Inequality | true |
3 < 5 | Less than | true |
3 <= 3 | Less or equal | true |
7 > 5 | Greater than | true |
7 >= 7 | Greater or equal | true |
Bitwise | Description | Result |
|---|---|---|
5 | 3 | Bitwise OR | 7 |
6 & 3 | Bitwise AND | 2 |
5 ˆ 3 | Bitwise XOR | 6 |
Strings | Description | Result |
|---|---|---|
"text" + "more" | Concatenation | "textmore" |
"a" == "b" | Equality | false |
"a" != "b" | Inequality | true |
Type Casting
Connect expressions use a set of .NET types. When a JSON node is referenced inside an expression and a cast is requested, the node is first resolved to its literal value. After resolution, the cast is attempted against the supported types:
Type | Description | Range |
|---|---|---|
bool | Boolean | true / false |
byte | Unsigned 8-bit int | 0 – 255 |
sbyte | Signed 8-bit int | -128 – 127 |
char | UTF-16 character | U+0000 – U+FFFF |
decimal | High-precision decimal | ±7.9E28 |
double | 64-bit float | ±1.7E308 |
float | 32-bit float | ±3.4E38 |
int | Signed 32-bit int | ±2.1B |
uint | Unsigned 32-bit int | 0 – 4.2B |
long | Signed 64-bit int | ~±9.2Q |
ulong | Unsigned 64-bit int | 0 – 18Q |
short | Signed 16-bit int | -32K – 32K |
ushort | Unsigned 16-bit int | 0 – 65K |
object | Any .NET object | Any |
string | Text string | Memory-limited |
Type hints are also recognized on literals, such as 1m for decimal, 1f for float, 1d for double, or 0b1010 for binary numbers. These markers explicitly control the literal’s type without requiring a cast.
Casting examples
Cast Expression | Behavior | Result |
|---|---|---|
(bool)true | Direct cast | true |
(byte)-1 | Wraps around | 255 |
(sbyte)128 | Overflow wraps | -128 |
(char)65 | Converts code to character | 'A' |
(float)1.23m | Decimal to float | 1.23 |
(double)1.1 | Double literal | 1.1 |
(decimal)1.1f | Float to decimal | 1.1 |
(int)1.9 | Truncates to integer | 1 |
(uint)-1 | Wraps around | 4294967295 |
(long)18446744073709551615UL | Overflow | -1 |
(ulong)-1L | Wraps around | 18446744073709551615 |
(short)65535 | Overflow | -1 |
(ushort)-1 | Wraps around | 65535 |
(string)$.text | Converts JSON value to string | "text" |
(JsonNode)"test" | Wraps value as JSON node | JSON node containing "test" |
Important: When working with values from JSON paths, they may resolve as JsonNode objects instead of primitive types. Comparisons or operations can fail if the types do not align. Use explicit casts in such cases, for example:
(string)$.test == "test"
or
$.test == (JsonNode)"test"
Collections
Collection expressions define arrays or lists directly within an expression, allowing multiple values to be grouped together. Mixed-type collections are not supported.
Collection | Description |
|---|---|
[1, 2, 3] | Array of numbers |
["a", "b", "c"] | Array of strings |
[true, false, true] | Array of booleans |
[] | Empty collection |
Element Access
Element access expressions in Connect follow the same syntax as in C#. They allow indexed access to elements of collections, but in practice the most useful application is working with strings. Strings can be treated like character arrays, making it possible to select individual characters or ranges of characters.
Expression | Result | Description |
|---|---|---|
"Hello"[0] | 'H' | First character |
"World"[4] | 'D' | Last character of "World" |
"abcdef"[1..4] | "bcd" | Characters from index 1 up to (not incl.) 4 |
"abcdef"[ˆ1] | 'f' | Last character |
"abcdef"[..3] | "abc" | From start up to (not incl.) index 3 |
"abcdef"[3..] | "def" | From index 3 to end |
($.store.storeName)[..ˆ3] | Example with value resolved from a path |
String Manipulation
Methods
Connect exposes helpful members. Common examples:
"abc".Contains("a") // true
" abc ".Trim() // "abc"
"abcdef".Substring(1, 3) // "bcd"
"abc".ToUpperInvariant() // "ABC"
"ABC".ToLowerInvariant() // "abc"
"a,b,c".Split(",") // ["a","b","c"]
"abc".Replace("b","x") // "axc"
Interpolation
String interpolation allows expressions to be evaluated directly inside strings. The syntax uses $"..." with { } braces to insert the result of an expression into the string. This makes it easy to combine text with values, including results from expressions or built-in .NET helpers.
Examples
$"Now: {DateTime.Now}"
Inserts the current date and time 9/25/2025 10:35:50 PM.
$"ID: {Guid.NewGuid()}"
Inserts a newly generated GUID, for example ID: 3f8a4c3e-2b8e-4f61-8f20-97c3b12d92bb.
$"$.data.books['{(DateTime.Now.Year).ToString()}']"
A JSON Path pointing to the books entry for the current year $.data.books['2026'].
Array Operations
In Connect, arrays can be transformed in more complex ways using expressions. This is mainly possible through the .NET Enumerable methods, which are also applicable to JSON arrays. Below is an example setup followed by selected expressions.
Rendering...
Transform tags to uppercase
($.book.tags).AsArray().Select(x => x.ToString().ToUpperInvariant())
// ["SOFTWARE", "ENGINEERING", "PROGRAMMING", "CRAFT"]
Filter ratings > 3
($.book.ratings).AsArray().Where(r => ((JsonNode)r).GetValue
// [5, 4, 5, 4]
Average of ratings
($.book.ratings).AsArray().Select(x => ((JsonNode)x).GetValue
// 4.2
Maximum rating
($.book.ratings).AsArray().Select(x => ((JsonNode)x).GetValue
// 5
Append title length to each tag
($.book.tags).AsArray().Select(t => t.ToString() + ":" + ($.book.title).ToString().Length)
// ["software:24", "engineering:24", "programming:24", "craft:24"]
Check if tags contain ‘craft’
($.book.tags).AsArray().Select(x => (x.ToString()).Contains("craft"))
// [false, false, false, true]
.NET Helpers
Member access in Connect expressions uses the dot operator (.). It is allowed to access members on instances, but not on types.
Valid:
"text".ToUpper()
123.ToString()
($.store.categories).ToString()
Invalid:
bool.TrueString
DateTime: Working with timestamps
DateTime.Now.ToString("yyyy-MM-dd") // "2025-09-25"
DateTime.Now.AddDays(1) // tomorrow's date
DateTime.UtcNow.Hour // current UTC hour
DateOnly: Calendar dates without time
DateOnly.FromDateTime(DateTime.Now) // "2025-09-25"
DateOnly.Parse("2025-01-01").Day // 1
TimeOnly: Clock times without date
TimeOnly.FromDateTime(DateTime.Now) // "23:15"
TimeOnly.Parse("08:30").AddMinutes(45)// "09:15"
TimeSpan: Durations and intervals
TimeSpan.FromHours(1.5) // 01:30:00
DateTime.Now.Add(TimeSpan.FromDays(7))// one week later
Enumerable: Sequence utilities
Enumerable.Range(1, 10) // [1,2,3,4,5,6,7,8,9,10]
Enumerable.Repeat
Guid: Generating unique IDs
Guid.NewGuid() // "3f8a4c3e-..."
Math: Numeric utilities
Math.Abs(-5) // 5
Math.Round(3.1415,2) // 3.14
Math.Max(1,10) // 10
JsonNode: JSON parsing and working with nodes
($.book.tags).AsArray().Count // 3
Regex: Pattern matching
Regex.IsMatch("abc123","[0-9]+") // true
Regex.Replace("abc123","[0-9]","x") // "abcxxx"
Object Members: Standard instance methods
42.Equals(42) // true
123.GetHashCode() // hash code of 123
Custom Helpers
ADF Helpers (Atlassian Document Format)
AdfHelper.BuildAdfParagraph("Hello World") // ADF paragraph node
AdfHelper.BuildAdfTable($.book.table) // ADF table node
Array Helpers
ArrayHelper.Append($.book.authors,"New Author")
// ["Andrew Hunt","David Thomas","New Author"]
ArrayHelper.Merge($.book.tags,$.book.moreTags)
// ["software","engineering","craft","best-practice","clean-code"]
Cast Helpers
Cast.Number($.book.price) // 42.5
Cast.String($.book.title) // "The Pragmatic Programmer"
Cast.MatchStrings(Regex.Matches($.book.isbn,"[0-9]"))
// ["9","7","8","0","2","0","1","6","1","6","2","2","4"]