> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/build/work-with-data/transform-data/approaches-for-transforming-data.md).

# 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](/build/work-with-data/understand-n8ns-data-structure.md) 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](/build/work-with-data/expressions-versus-data-nodes.md#expressions) allow you to transform data directly in node parameters using n8n's expression syntax (`{{ }}`)
* The [Code node](/build/work-with-data/expressions-versus-data-nodes.md#code-node) lets you write custom JavaScript or Python for complex transformations.
* The [AI Transform node](/build/work-with-data/expressions-versus-data-nodes.md#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
* Specialized transformation nodes for common structural transformations:
  * [Aggregate](/integrations/builtin/core-nodes/n8n-nodes-base.aggregate.md): group separate items together
  * [Limit](/integrations/builtin/core-nodes/n8n-nodes-base.limit.md): restrict the number of items
  * [Remove Duplicates](/integrations/builtin/core-nodes/n8n-nodes-base.removeduplicates.md): eliminate identical items
  * [Sort](/integrations/builtin/core-nodes/n8n-nodes-base.sort.md): order items or randomize
  * [Split Out](/integrations/builtin/core-nodes/n8n-nodes-base.splitout.md): separate lists into individual items
  * [Summarize](/integrations/builtin/core-nodes/n8n-nodes-base.summarize.md): aggregate data like Excel pivot tables

For a comparison of these approaches, see [Expressions versus data nodes](/build/work-with-data/expressions-versus-data-nodes.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.n8n.io/build/work-with-data/transform-data/approaches-for-transforming-data.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
