younifyd
Menu

Map Fields

Map fields from source data to a new target shape using structured field mappings, built-in transforms, and array-to-array mapping.

Use it in a workflow

  1. Add a step and choose the Mapper connector.
  2. Pick the Map Fields action (under data).
  3. Fill in the fields below, then reference the result from later steps as {{mapFields.response.data}}.

Fields

datastringrequired

The JSON data to map (object, array, or a JSON string). Can reference previous steps, e.g. {{trigger.body}}.

mappingsarray<object>required

Define how source fields map to target fields. An 'Array Group' produces a list in the output, one entry per source item. An 'Object Group' produces a single nested object built from its child fields.

kindstringrequired

Pick by what the OUTPUT needs. 'field': one value. 'arrayGroup': a LIST in the output, one entry per item of a source list — requires sourcePath, and child paths in `mappings` are relative to each item. 'objectGroup': ONE nested object in the output, built from the child mappings in `mappings` — sourcePath is optional, and blank means the children read from the whole payload. A list is never an objectGroup and a single object is never an arrayGroup.

One offieldarrayGroupobjectGroupDefault "field"

mappingsarray<object>

Required on arrayGroup and objectGroup — the mappings applied inside the group. Omit on a plain field.

sourcePathstring

Leave blank for a static/constant field with no real source — pair with the 'defaultValue' transform to supply the literal value. On an Object Group, blank means the children read from the current scope, which is how a flat payload is gathered into an object.

targetPathstringrequired
optionsobject
onValidationErrorstring

One ofhaltcollectDefault "halt"

errorResponseobject3 fields

Configure the response when validation fails in halt mode. If not provided, a default error response is used.

Examples

Reshape a webhook payload

Map a subset of an incoming order payload into a flatter shape, converting price to a number and defaulting a missing currency

json
{
  "data": "{\"order\": {\"id\": \"abc123\", \"amount\": \"42.50\"}}",
  "mappings": [
    {
      "kind": "field",
      "id": "id",
      "sourcePath": "order.id",
      "targetPath": "orderId"
    },
    {
      "kind": "field",
      "id": "amount",
      "sourcePath": "order.amount",
      "targetPath": "total",
      "transform": {
        "kind": "builtin",
        "name": "toNumber"
      }
    },
    {
      "kind": "field",
      "id": "currency",
      "sourcePath": "order.currency",
      "targetPath": "currency",
      "transform": {
        "kind": "builtin",
        "name": "defaultValue",
        "params": {
          "value": "USD"
        }
      }
    }
  ]
}

Need more? See the Mapper guide for connection setup and behaviour shared by every action.

Was this page helpful?