Transform Map

Transform Map

Certified

Normalize and enrich records

Reshape records by selecting fields, casting types, and deriving new typed values from expressions without scripts.

yaml
type: io.kestra.plugin.transform.Map

Normalize records

yaml
id: map_normalize_records
namespace: company.team

tasks:
  - id: fetch
    type: io.kestra.plugin.core.output.OutputValues
    values:
      records:
        - user:
            id: c1
          createdAt: "2026-01-01T00:00:00Z"
          items:
            - price: 10.5

  - id: map
    type: io.kestra.plugin.transform.Map
    from: "{{ outputs.fetch.values.records }}"
    fields:
      customer_id:
        expr: user.id
        type: STRING
      created_at:
        expr: createdAt
        type: TIMESTAMP
      total:
        expr: sum(items[].price)
        type: DECIMAL
    dropNulls: true
    onError: SKIP

Map DuckDB stored results

yaml
id: map_duckdb_stored
namespace: company.team

tasks:
  - id: query1
    type: io.kestra.plugin.jdbc.duckdb.Query
    sql: SELECT now() as "ts";
    fetchType: STORE

  - id: map
    type: io.kestra.plugin.transform.Map
    from: "{{ outputs.query1.uri }}"
    outputType: RECORDS
    fields:
      ts:
        expr: ts
        type: TIMESTAMP

Map direct output values

yaml
id: map_direct_outputs
namespace: company.team

tasks:
  - id: query1
    type: io.kestra.plugin.jdbc.duckdb.Query
    sql: SELECT 1 as "value" UNION ALL SELECT 2 as "value";
    fetchType: FETCH

  - id: map
    type: io.kestra.plugin.transform.Map
    from: "{{ outputs.query1.records }}"
    fields:
      value:
        expr: value
        type: INT

Download JSON and transform

yaml
id: map_http_download
namespace: company.team

tasks:
  - id: download
    type: io.kestra.plugin.core.http.Download
    uri: https://dummyjson.com/products

  - id: map
    type: io.kestra.plugin.transform.Map
    from: "{{ outputs.download.uri }}"
    outputType: RECORDS
    fields:
      first_title:
        expr: products[0].title
        type: STRING
Properties

Fields

Output field definitions keyed by target field name. Each value can be a shorthand expression string or an object with expr, optional type, and optional.

Definitions
exprstring

Expression

Per-record expression used to compute the output field value.

optionalboolean
Defaultfalse

Optional

When true, allows the field to be absent from the input record. A field that is present with a null value is always allowed and maps to null, whatever this is set to. Expression and cast errors are still handled by onError.

typestring
Possible Values
STRINGINTFLOATDECIMALBOOLEANTIMESTAMPLISTSTRUCT

Output type

Optional type to cast the evaluated value to before writing the output field.

Input records

Ion list or struct to transform, or a storage URI pointing to an Ion file.

Defaulttrue

Drop null fields

Omits output fields whose final value is null after mapping.

Defaultfalse

Keep original fields

Keeps input fields not explicitly mapped. If you map a_new: a, the original a is still kept.

DefaultFAIL
Possible Values
FAILSKIPNULL

On error behavior

FAIL stops the task on the first field error, SKIP drops the current record, and NULL writes null for failing fields.

DefaultTEXT
Possible Values
TEXTBINARY

Output format

Experimental: TEXT or BINARY. Only transform tasks can read binary Ion. Use TEXT as the final step.

DefaultAUTO
Possible Values
AUTORECORDSSTORE

Output type

AUTO stores to internal storage when the input is a storage URI; otherwise it returns records.

Reference (ref) of the pluginDefaults to apply to this task.

Transformed records

JSON-safe records when output mode is RECORDS or AUTO resolves to RECORDS.

Stored Ion file URI

URI to the stored Ion file when output mode is STORE or AUTO resolves to STORE.