Generate AI Mapping
AI-generatedSummary
Generate JSONata mapping configurations using AI by providing source JSON data (either pasted or from incoming items) and target JSON structure samples or schemas, optionally leveraging source and target JSON Schemas for validation and context. The operation sends a crafted prompt to a configured LLM provider to receive suggested JSONata mapping rules for transforming source JSON into the desired target format.
Inputs
- Source Document Mode (required) — Choose whether to use incoming item JSON or a pasted JSON document as the source for mapping generation.
- Source Field — Field path in the incoming item JSON containing the source JSON to map; applicable when using incoming item JSON.
- Source JSON Document — A pasted JSON document used as the source document for designing mapping at design time or AI auto-mapping; applicable when pasting source JSON.
- Use Source JSON Schema — Enable providing a source JSON Schema for validation and to give AI context about the source structure.
- Source JSON Schema — JSON Schema describing the source document structure and constraints; required if 'Use Source JSON Schema' is true.
- Use Target JSON Schema — Enable providing a target JSON Schema for output validation and AI context.
- Target JSON Schema — JSON Schema describing the desired target document structure; required if 'Use Target JSON Schema' is true.
- Target Sample JSON (required) — Sample JSON structure for the target format, used as AI context or when no target schema is supplied.
- LLM Provider (required) — Select the AI model provider format for generating JSONata mapping suggestions.
- AI Model (required) — Specify the AI model name used for mapping generation, depending on the LLM provider.
- Custom HTTP Path — Optional path appended to the base URL when using a custom HTTP JSON endpoint provider.
- AI Temperature — Controls randomness of AI generation; typical values range from 0 (deterministic) to 2 (more creative).
- Return Debug Info — Include detailed debug information such as AI prompts and raw responses in the output for troubleshooting.
Output shape
a single n8n item containing a JSON object
The JSON output contains a 'mappingConfig' field with the generated JSONata mapping configuration. If 'Return Debug Info' is enabled, the output also includes the AI prompt and raw LLM response. Errors during AI communication or invalid responses cause node errors unless 'Continue On Fail' is enabled.
Examples
Example 1: Auto-generate mappings from source JSON and target sample using OpenAI GPT-4
Provide the source JSON as incoming item or paste it; supply a target JSON sample structure; select OpenAI-compatible as the LLM provider; choose the GPT model; set temperature as desired; and trigger the operation.