Mapping Methods Reference
Transform data using string, object, and array methods
tip
Check out the Connectors Mapping Playground to experiment with and troubleshoot mapping expressions.
This reference documents all available transformation methods in the Connectors mapping language.
You use methods with the ->method
syntax to manipulate strings, objects, arrays, and other data types.
Each method accepts arguments that can be JSON literals (numbers, strings, booleans, arrays, objects, and null
) or special variables like $
, $args
, $this
, or $config
.
See the common mapping patterns pages in the response mapping docs for example snippets of common transformations.
String methods
Method | Description | Example |
---|---|---|
| Returns a slice of a string | firstTwoChars: countryCode->slice(0, 2) |
| Returns the length of a string | wordLength: word->size |
Object methods
Method | Description | Example |
---|---|---|
| Returns a list of key-value pairs | keyValuePairs: object->entries |
| Returns the number of properties in an object | propCount: object->size |
Array methods
Method | Description | Example |
---|---|---|
| Returns the first value in a list | firstColor: colors->first |
| Concatenates an array of string values using the specified separator and ignoring null values | $(["a", "b", null, "c"])->joinNotNull(',') |
| Returns the last value in a list | lastColor: colors->last |
| Maps a list of values to a new list, or converts a single item to a list | colors: colors->map({ name: @ }) |
| Returns a slice of a list | firstTwoColors: colors->slice(0, 2) |
| Returns the length of a list | colorCount: colors->size |
Other methods
Method | Description | Example |
---|---|---|
| Evaluates and returns its first argument | wrappedValue: value->echo({ wrapped: @ }) |
| Converts a value to a JSON string | jsonBody: body->jsonStringify |
| Replaces a value with a new value if it matches another value | status: status->match([1, "one"], [2, "two"], [@, "other"]) |