Skip to content

Expression Functions

Built-in functions available in expressions.

String Functions

toUpperCase()

Convert to uppercase:

{{ $json.name.toUpperCase() }}  // "JOHN"

toLowerCase()

Convert to lowercase:

{{ $json.name.toLowerCase() }}  // "john"

trim()

Remove whitespace:

{{ $json.text.trim() }}  // "hello" (from "  hello  ")

replace()

Replace text:

{{ $json.text.replace("old", "new") }}
{{ $json.text.replace(/\s+/g, "-") }}  // Regex

split()

Split into array:

{{ $json.tags.split(",") }}  // ["tag1", "tag2", "tag3"]

substring()

Extract portion:

{{ $json.text.substring(0, 10) }}  // First 10 chars

includes()

Check if contains:

{{ $json.email.includes("@gmail.com") }}  // true/false

startsWith() / endsWith()

Check prefix/suffix:

{{ $json.url.startsWith("https://") }}
{{ $json.file.endsWith(".pdf") }}

padStart() / padEnd()

Pad string:

{{ String($json.id).padStart(5, "0") }}  // "00042"

Number Functions

Math.round()

Round to nearest integer:

{{ Math.round($json.price) }}  // 10 (from 9.7)

Math.floor() / Math.ceil()

Round down/up:

{{ Math.floor($json.value) }}  // 9 (from 9.7)
{{ Math.ceil($json.value) }}   // 10 (from 9.2)

Math.abs()

Absolute value:

{{ Math.abs($json.difference) }}  // 5 (from -5)

Math.min() / Math.max()

Find minimum/maximum:

{{ Math.min($json.a, $json.b) }}
{{ Math.max(...$json.values) }}  // From array

toFixed()

Format decimal places:

{{ $json.price.toFixed(2) }}  // "9.99"

parseInt() / parseFloat()

Parse numbers:

{{ parseInt($json.stringNum) }}     // 42
{{ parseFloat($json.stringDec) }}   // 3.14

Array Functions

length

Get array length:

{{ $json.items.length }}  // 5

join()

Join elements:

{{ $json.tags.join(", ") }}  // "tag1, tag2, tag3"

map()

Transform elements:

{{ $json.users.map(u => u.name) }}  // ["John", "Jane"]

filter()

Filter elements:

{{ $json.items.filter(i => i.active) }}

find()

Find first match:

{{ $json.users.find(u => u.id === 123) }}

reduce()

Aggregate values:

{{ $json.items.reduce((sum, i) => sum + i.price, 0) }}

includes()

Check if contains:

{{ $json.roles.includes("admin") }}  // true/false

indexOf()

Find position:

{{ $json.items.indexOf("target") }}  // -1 if not found

slice()

Extract portion:

{{ $json.items.slice(0, 5) }}  // First 5 items

sort()

Sort array:

{{ $json.numbers.sort((a, b) => a - b) }}  // Ascending
{{ $json.names.sort() }}  // Alphabetical

reverse()

Reverse order:

{{ $json.items.reverse() }}

Object Functions

Object.keys()

Get property names:

{{ Object.keys($json.data) }}  // ["name", "age", "email"]

Object.values()

Get property values:

{{ Object.values($json.data) }}  // ["John", 30, "[email protected]"]

Object.entries()

Get key-value pairs:

{{ Object.entries($json.data) }}  // [["name", "John"], ["age", 30]]

JSON.stringify()

Convert to JSON string:

{{ JSON.stringify($json.data) }}
{{ JSON.stringify($json.data, null, 2) }}  // Pretty print

JSON.parse()

Parse JSON string:

{{ JSON.parse($json.jsonString) }}

Date Functions

new Date()

Create date:

{{ new Date() }}                    // Current date/time
{{ new Date($json.timestamp) }}     // From timestamp
{{ new Date($json.dateString) }}    // From string

Date Methods

{{ new Date().toISOString() }}        // "2024-01-15T10:30:00.000Z"
{{ new Date().toLocaleDateString() }} // "1/15/2024"
{{ new Date().toLocaleTimeString() }} // "10:30:00 AM"
{{ new Date().getFullYear() }}        // 2024
{{ new Date().getMonth() }}           // 0 (January)
{{ new Date().getDate() }}            // 15
{{ new Date().getDay() }}             // 1 (Monday)
{{ new Date().getTime() }}            // Unix timestamp ms

Date Arithmetic

// Add days
{{ new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000).toISOString() }}

// Days between dates
{{ Math.floor((new Date($json.end) - new Date($json.start)) / (1000 * 60 * 60 * 24)) }}

Type Functions

typeof

Check type:

{{ typeof $json.value }}  // "string", "number", "object", etc.

Array.isArray()

Check if array:

{{ Array.isArray($json.items) }}  // true/false

String()

Convert to string:

{{ String($json.number) }}  // "42"

Number()

Convert to number:

{{ Number($json.string) }}  // 42

Boolean()

Convert to boolean:

{{ Boolean($json.value) }}  // true/false

Utility Functions

encodeURIComponent()

URL encode:

{{ encodeURIComponent($json.query) }}

decodeURIComponent()

URL decode:

{{ decodeURIComponent($json.encoded) }}

btoa()

Base64 encode:

{{ btoa($json.text) }}

atob()

Base64 decode:

{{ atob($json.encoded) }}

Common Patterns

Format Currency

{{ "$" + $json.price.toFixed(2) }}  // "$9.99"

Slugify String

{{ $json.title.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "") }}

Extract Domain

{{ new URL($json.url).hostname }}  // "example.com"

Format Date

{{ new Date($json.date).toLocaleDateString("en-US", {
  year: "numeric",
  month: "long",
  day: "numeric"
}) }}  // "January 15, 2024"

Safe Access

{{ $json.data?.nested?.field ?? "default" }}

Unique Array

{{ [...new Set($json.items)] }}

Group Count

{{ $input.all.filter(i => i.json.status === "active").length }}