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

MethodDescriptionExample
sliceReturns a slice of a stringfirstTwoChars: countryCode->slice(0, 2)
sizeReturns the length of a stringwordLength: word->size

Object methods

MethodDescriptionExample
entriesReturns a list of key-value pairskeyValuePairs: object->entries
sizeReturns the number of properties in an object.propCount: object->size

Array methods

MethodDescriptionExample
firstReturns the first value in a listfirstColor: colors->first
lastReturns the last value in a listlastColor: colors->last
mapMaps a list of values to a new list, or converts a single item to a listcolors: colors->map({ name: @ })
sliceReturns a slice of a listfirstTwoColors: colors->slice(0, 2)
sizeReturns the length of a listcolorCount: colors->size

Other methods

MethodDescriptionExample
echoEvaluates and returns its first argumentwrappedValue: value->echo({ wrapped: @ })
jsonStringifyConverts a value to a JSON stringjsonBody: body->jsonStringify
matchReplaces a value with a new value if it matches another valuestatus: status->match([1, "one"], [2, "two"], [@, "other"])
Feedback

Ask Community