Skip to content

Expression Syntax Reference

Complete syntax reference for TinySystems expressions.

Basic Syntax

Expression Delimiters

{{expression}}

All expressions are enclosed in double curly braces.

Root Reference

$

The $ symbol references the root of the input data.


Grammar (BNF)

expression     := "{{" expr "}}"
expr           := primary | binary | unary | ternary | call
primary        := path | literal | "(" expr ")"
path           := "$" accessor*
accessor       := "." identifier | "[" expr "]"
binary         := expr operator expr
unary          := "!" expr
ternary        := expr "?" expr ":" expr
call           := identifier "(" args? ")"
args           := expr ("," expr)*
literal        := string | number | boolean | null
string         := "'" characters "'" | "\"" characters "\""
number         := integer | float
boolean        := "true" | "false"
null           := "null"
identifier     := letter (letter | digit | "_")*

Path Expressions

Dot Notation

Access object properties:

$.property
$.parent.child
$.deeply.nested.property

Bracket Notation

Access with computed keys or special characters:

$["property"]
$["property with spaces"]
$[$.dynamicKey]

Array Access

Access array elements:

$.array[0]           // First element (0-indexed)
$.array[1]           // Second element
$.array[-1]          // Last element
$.array[-2]          // Second to last

Combined Access

Mix notations:

$.users[0].name
$.data["field-name"][0]
$.items[$.index].value

Literals

Strings

'single quotes'
"double quotes"

Numbers

42              // Integer
3.14            // Float
-17             // Negative
1.5e10          // Scientific

Booleans

true
false

Null

null

Operators

Arithmetic

OperatorDescriptionExample
+Addition{{$.a + $.b}}
-Subtraction{{$.a - $.b}}
*Multiplication{{$.a * $.b}}
/Division{{$.a / $.b}}
%Modulo{{$.a % $.b}}

Comparison

OperatorDescriptionExample
==Equal{{$.a == $.b}}
!=Not equal{{$.a != $.b}}
>Greater than{{$.a > $.b}}
<Less than&#123;&#123;$.a < $.b&#125;&#125;
>=Greater or equal&#123;&#123;$.a >= $.b&#125;&#125;
<=Less or equal&#123;&#123;$.a <= $.b&#125;&#125;

Logical

OperatorDescriptionExample
&&Logical AND&#123;&#123;$.a && $.b&#125;&#125;
||Logical OR&#123;&#123;$.a || $.b&#125;&#125;
!Logical NOT&#123;&#123;!$.a&#125;&#125;

String

OperatorDescriptionExample
+Concatenation&#123;&#123;'Hello ' + $.name&#125;&#125;

Operator Precedence

From highest to lowest:

  1. () - Parentheses
  2. ! - Unary NOT
  3. *, /, % - Multiplicative
  4. +, - - Additive
  5. >, <, >=, <= - Relational
  6. ==, != - Equality
  7. && - Logical AND
  8. || - Logical OR
  9. ? : - Ternary

Conditional (Ternary) Operator

condition ? valueIfTrue : valueIfFalse

Examples:

{{$.active ? 'yes' : 'no'}}
{{$.count > 0 ? $.count : 0}}
{{$.type == 'admin' ? 'Full Access' : 'Limited'}}

Function Calls

functionName(arg1, arg2, ...)

Examples:

{{now()}}
{{RFC3339($.timestamp)}}
{{string($.count)}}
{{upper($.name)}}

Expression Types

Pure Expressions (No Quotes)

Return typed values:

yaml
count: {{$.count}}           # Returns number
active: {{$.isActive}}       # Returns boolean
items: {{$.array}}           # Returns array
user: {{$.data}}             # Returns object

String Interpolation (With Quotes)

Always return strings:

yaml
countStr: "{{$.count}}"      # Returns string "42"
message: "Hello {{$.name}}"  # Returns string
url: "api/{{$.id}}/data"     # Returns string

Special Cases

Default Values

{{$.value || 'default'}}
{{$.count || 0}}
{{$.items || []}}

Null Coalescing

{{$.user != null ? $.user.name : 'Anonymous'}}

String in Expression

Use single quotes for strings within expressions:

{{$.role == 'admin'}}
{{$.type != 'test'}}
{{'prefix_' + $.id}}

Escaping

Literal Curly Braces

To output literal &#123;&#123;:

\{\{not an expression\}\}

Quotes in Strings

"He said 'hello'"
'She said "hi"'
"Escaped \"quote\""

Whitespace

Whitespace inside expressions is ignored:

{{ $.name }}
{{$.name}}
{{ $.count + 1 }}
{{$.count+1}}

All equivalent.


Validation Rules

Valid Expressions

{{$}}
{{$.name}}
{{$.items[0]}}
{{$.a + $.b}}
{{$.active ? 'yes' : 'no'}}
{{now()}}

Invalid Expressions

{{}}                    // Empty
{{.name}}               // Missing $
{{$name}}               // Missing dot
{{$.items[}}            // Unclosed bracket
{{$.a +}}               // Incomplete operation

Edge Configuration Format

In edge configurations:

yaml
# Pure expression - type preserved
count: {{$.items.length}}

# Interpolated string
message: "Count is {{$.items.length}}"

# Static value
constant: 42

# Object construction
user:
  id: "{{$.userId}}"
  name: "{{$.userName}}"

Quick Reference

PatternExampleResult
Root&#123;&#123;$&#125;&#125;Entire input
Property&#123;&#123;$.name&#125;&#125;Property value
Nested&#123;&#123;$.a.b.c&#125;&#125;Deep property
Array index&#123;&#123;$.arr[0]&#125;&#125;First element
Negative index&#123;&#123;$.arr[-1]&#125;&#125;Last element
Bracket access&#123;&#123;$['key']&#125;&#125;Property by string
Dynamic key&#123;&#123;$[$.key]&#125;&#125;Property by variable
Addition&#123;&#123;$.a + $.b&#125;&#125;Sum
Comparison&#123;&#123;$.a == 1&#125;&#125;Boolean
Logical&#123;&#123;$.a && $.b&#125;&#125;Boolean
Ternary&#123;&#123;$.a ? 1 : 2&#125;&#125;Conditional
Function&#123;&#123;now()&#125;&#125;Function result
Default&#123;&#123;$.x || 'default'&#125;&#125;Fallback
Interpolation"Hi &#123;&#123;$.n&#125;&#125;"String

Build flow-based applications on Kubernetes