Apply Mapping
AI-generatedSummary
Transform source JSON data into a mapped target JSON structure using JSONata expressions, with options for source input mode, schema validation, and JavaScript field transforms.
Inputs
- Source Document Mode (required) — Choose whether to map the incoming n8n item JSON or a pasted source JSON document.
- Source Field — Field path containing the source JSON within each incoming item; used only if 'Use Incoming Item JSON' is selected. Use 'json' for the whole item JSON.
- Source JSON Document — Pasted source JSON document for mapping, used only if 'Paste Source JSON Document' mode is selected.
- Use Source JSON Schema — Enable validation and AI context with a source JSON Schema.
- Source JSON Schema — JSON Schema describing the source document for validation and AI context; required if source schema is enabled.
- Use Target JSON Schema — Enable validation and AI context with a target JSON Schema.
- Target JSON Schema — JSON Schema describing the required target document for validation and AI context; required if target schema is enabled.
- Mapping Config (required) — JSONata mapping configuration with an array of mappings, each specifying a target path and JSONata expression to transform the source JSON.
- Validate Source With Schema — Enable validation of source JSON against provided source schema prior to mapping when available.
- Validate Output With Target Schema — Enable validation of mapped output against provided target schema after mapping when available.
- Enable JavaScript Field Transforms — Allow applying JavaScript code transforms on fields during mapping; only enable in trusted environments.
- Return Debug Info — Return detailed debug information including the mapping expressions and intermediate values.
Output shape
a JSON object representing the mapped target structure for each input item, optionally including debug information if enabled
If schema validation fails on source or output, the operation throws an error unless 'Continue On Fail' is enabled. When debug mode is active, output includes detailed mapping evaluation data alongside the mapped result.
Examples
Example 1: Mapping input data with JSONata expressions to a new target JSON format
Sets input source to the entire incoming item JSON, uses a provided mapping config JSON with defined target paths and JSONata expressions, enables optional source and target JSON schema validation, and optionally allows JavaScript transforms for complex field-level data manipulation. Returns mapped JSON objects with optional debug data.