mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2026-03-27 09:28:43 +07:00
2.2 KiB
2.2 KiB
contentType
| contentType |
|---|
| explanation |
Approaches for transforming data
Data transformation in n8n involves modifying, restructuring, or enriching data as it moves through your workflow. This includes changing data formats, filtering or aggregating values, adding computed fields, and converting data structures to work with different nodes.
n8n uses a predefined data structure that allows all nodes to process incoming data correctly. When your data doesn't match this structure, or when you need to modify it for your use case, you'll need to transform it.
n8n provides several approaches for data transformation:
- Expressions allow you to transform data directly in node parameters using n8n's expression syntax (
{{ }}) - The Code node lets you write custom JavaScript or Python for complex transformations.
- The AI Transform node generates transformation code from natural language prompts.
- Advanced transformation techniques: For sophisticated data manipulation, n8n supports:
- Ternary operators: Conditional logic directly in expressions (
condition ? valueIfTrue : valueIfFalse) - Chained functions: Combine multiple transformation functions
- Complex expressions: Use JavaScript methods and operators within expression syntax
- Ternary operators: Conditional logic directly in expressions (
- Specialized transformation nodes for common structural transformations:
For a comparison of these approaches, see Expressions versus data nodes.