All Products
Search
Document Center

CloudFlow:Built-in functions

Last Updated:Mar 11, 2026

CloudFlow's Flow Definition Language (FDL) provides built-in functions for data processing within workflow definitions. Use these functions to manipulate strings, arrays, maps, and JSON data without writing external function code.

Important

To use a built-in function in an input or output constructor, append .$ to the constructor key. This tells CloudFlow to evaluate the value as an expression. Without the .$ suffix, the value is treated as a plain string. A maximum of 10 nested function calls are supported per expression.

Example: Using a built-in function in an FDL constructor

{
  "inputMappings": {
    "greeting.$": "format('Hello, {}', $input.username)"
  }
}

In this example, greeting.$ tells CloudFlow that the value is an expression containing the format function, not a literal string.

Function reference

The following tables list all built-in functions, grouped by category.

Common operations

FunctionPurpose
formatFormat a string using {} placeholders
lengthGet the length of a string, array, or map
regexMatchStringMatch a string against a regular expression
splitSplit a string by a delimiter

Array operations

FunctionPurpose
arrayContainsCheck whether an array contains a specific element
arrayUniqueRemove duplicate elements from an array
toArrayConvert a variable number of arguments into an array

Map operations

FunctionPurpose
mapKeysExtract all keys from a JSON object or map as an array
mapValuesExtract all values from a JSON object or map as an array
mapValuesPartitionExtract values from a map and split them into sub-arrays by step size

Data encoding and decoding

FunctionPurpose
toBase64Encode a string to Base64
fromBase64Decode a Base64-encoded string

Hash calculation and UUID generation

FunctionPurpose
hashGenerate a hash value using a specified algorithm
uuidGenerate a universally unique identifier (UUID)

JSON data operations

FunctionPurpose
jsonToStringConvert a JSON object or map to a JSON string
stringToJsonParse a JSON string into a JSON object or map
jsonMergeMerge two JSON objects or maps into one

Common operations

format

Formats a string by replacing {} placeholders with the provided arguments, in order.

Syntax

format(template, arg1, arg2, ...)

Parameters

ParameterTypeRequiredDescription
templatestringYesA template string containing {} placeholders
arg1, arg2, ...anyYesValues to substitute into the placeholders, in order

Return type: string

Examples

format("hello {}", "world")
// Returns: "hello world"

FDL usage:

{ "message.$": "format('Task {} completed at {}', $input.taskName, $input.timestamp)" }

length

Returns the length of a string, array, or map.

  • For a string, returns the number of characters.

  • For an array, returns the number of elements.

  • For a map, returns the number of key-value pairs.

Syntax

length(value)

Parameters

ParameterTypeRequiredDescription
valuestring, []any, or map[string]anyYesThe string, array, or map to measure

Return type: int

Examples

length([1, 2, 3])
// Returns: 3

length({"name": "Tom", "age": 10})
// Returns: 2

length("name")
// Returns: 4

FDL usage:

{ "itemCount.$": "length($input.orderItems)" }

regexMatchString

Tests whether a string matches a regular expression pattern. Returns true if the pattern matches, false otherwise.

Syntax

regexMatchString(pattern, value)

Parameters

ParameterTypeRequiredDescription
patternstringYesThe regular expression pattern
valuestringYesThe string to test against the pattern

Return type: bool

Examples

regexMatchString("p([a-z]+)ch", "peach")
// Returns: true

regexMatchString("p([a-z]+)ch", "p123ch")
// Returns: false

FDL usage:

{ "isValid.$": "regexMatchString('^[a-zA-Z0-9]+$', $input.userId)" }

split

Splits a string into an array of substrings based on a delimiter.

Syntax

split(value, delimiter)

Parameters

ParameterTypeRequiredDescription
valuestringYesThe string to split
delimiterstringYesThe delimiter to split on

Return type: []string

Examples

split("item1,item2,item3", ",") // Returns: ["item1", "item2", "item3"]

FDL usage:

{ "tags.$": "split($input.tagString, ',')" }

Array operations

arrayContains

Checks whether an array contains a specific element. Returns true if the element is found, false otherwise.

Syntax

arrayContains(array, element)

Parameters

ParameterTypeRequiredDescription
array[]anyYesThe array to search
elementanyYesThe element to search for

Return type: bool

Examples

arrayContains(["Tom", 10], 10) // Returns: true arrayContains(["Tom", 10], "Jack") // Returns: false

FDL usage:

{ "isAllowed.$": "arrayContains($input.allowedRegions, $input.targetRegion)" }

arrayUnique

Removes duplicate elements from an array and returns the deduplicated result.

Syntax

arrayUnique(array)

Parameters

ParameterTypeRequiredDescription
array[]anyYesThe array to deduplicate

Return type: []any

Examples

arrayUnique([1, 2, 3, 1])
// Returns: [1, 2, 3]

toArray

Converts a variable number of arguments into a single array.

Syntax

toArray(arg1, arg2, ...)

Parameters

ParameterTypeRequiredDescription
arg1, arg2, ...anyYesOne or more values to combine into an array

Return type: []any

Examples

toArray(1,'strig',$Input.var)
// Returns: []any{1, 'string', $valueOfVar}

Map operations

mapKeys

Extracts all keys from a JSON object or map and returns them as a string array.

Syntax

mapKeys(map)

Parameters

ParameterTypeRequiredDescription
mapmap[string]anyYesThe JSON object or map to extract keys from

Return type: []string

Examples

mapKeys({"name": "Tom", "age": 10})
// Returns: ["name", "age"]

mapValues

Extracts all values from a JSON object or map and returns them as an array.

Syntax

mapValues(map)

Parameters

ParameterTypeRequiredDescription
mapmap[string]anyYesThe JSON object or map to extract values from

Return type: []any

Examples

mapValues({"name": "Tom", "age": 10})
// Returns: ["Tom", 10]

mapValuesPartition

Extracts all values from a JSON object or map and partitions them into sub-arrays of a specified size.

Syntax

mapValuesPartition(map, stepSize)

Parameters

ParameterTypeRequiredDescription
mapmap[string]anyYesThe JSON object or map to extract values from
stepSizeintYesThe number of elements per sub-array

Return type: [][]any

Examples

mapValuesPartition({"name": "Tom", "age": 10}, 1) // Returns: ["Tom"],[10]

Data encoding and decoding

toBase64

Encodes a string to Base64.

Syntax

toBase64(value)

Parameters

ParameterTypeRequiredDescription
valuestringYesThe string to encode

Return type: string

Examples

toBase64("FnF")
// Returns: "Rm5G"

fromBase64

Decodes a Base64-encoded string back to its original value.

Syntax

fromBase64(value)
ParametersParameterTypeRequiredDescriptionvaluestringYesThe Base64-encoded string to decode
Return type: string
ExamplesfromBase64("Rm5G")
// Returns: "FnF"

Hash calculation and UUID generation

hash

Generates a hash value for the given input using a specified algorithm.

Syntax

id="dfc2079465bd1_19"Code" data-tag="codeblock" id="dfc2079465bd1" outputclass="language-bash">hash(input, algorithm)

Parameters

ParameterTypeRequiredDescription
inputstringYesThe string to hash
algorithmstringYesThe hash algorithm. Supported values: MD5, SHA-1, SHA-256, SHA-512

Return type: string

Examples

hash("abc", "MD5")
// Returns: "900150983cd24fb0d6963f7d28e17f72"

FDL usage:

{
  "checksum.$": "hash($input.payload, 'SHA-256')"
}

uuid

Generates a universally unique identifier (UUID).

Syntaxuuid()

Parameters

None.

Return type: string

Examples

uuid() // Returns: "159fd8c1-2ec3-4d7b-b9fd-60b9d8841000"

FDL uid="dfc2079465bd1_22"e-type="xCode" data-tag="codeblock" id="dfc2079465bd1" outputclass="language-json">{ "requestId.$": "uuid()" }

JSON data operations

jsonToString

Converts a JSON object or map to its string representation.

Syid="dfc2079465bd1_23"code-type="xCode" data-tag="codeblock" id="dfc2079465bd1" outputclass="language-bash">jsonToString(value)

Parameters

ParameterTypeRequiredDescription
valuemap[string]anyYesThe JSON object or map to serialize

Return type: string

Examples

toJSON({"name": "Tom", "age": 10}) // Returns: '{"name": "Tom", "age": 10}'

stringToJson

Parses a JSON string into a JSON object or map.

Syntax

stringToJson(value)

Parameters

ParameterTypeRequiredDescription
valuestringYesA valid JSON string

Return type: map[string]any

Examples

stringToJson('{"name": "Tom", "age": 10}')
// Returns: {"name": "Tom", "age": 10}

FDL usage:

{ "parsedBody.$": "stringToJson($input.responseBody)" }

jsonMerge

Merges two JSON objects or maps into one.

jsonMerge(object1, object2)
ParametersParameterTypeRequiredDescriptionobject1map[string]anyYesThe first JSON object or mapobject2map[string]anyYesThe second JSON object or map
Return type: map[string]any
ExamplesjsonMerge({"name": "Tom", "age": 10}, {"name": "Tom", "address": "beijing"})
// Returns: {"name": "Tom", "age": 10, "address": "beijing"}
{
  "mergedConfig.$": "jsonMerge($input.defaultConfig, $input.userOverrides)"
}