> For the complete documentation index, see [llms.txt](https://docs.uibakery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uibakery.io/build-from-scratch/getting-started/transform-data-with-javascript.md).

# Transform data with JavaScript

UI Bakery allows transforming the data that comes from a database or an API by writing JavaScript code. You can do this by adding another action step inside your action and adding JavaScript code that will do what you need. Below, we'll show you how to do that based on the use case of adding a *Full name* property as a concatenation of the First and Last name properties.

## **To transform your data with JS:**

1. Go to your action (for example, *Load Users*) and add another action step of the **JavaScript Code** type.
2. Next, write your code in the JavaScript field.\
   In our case, we added the following code:

```javascript
return data.map(item => {
  return {...item, full_name: item.first_name + " " + item.last_name };
});
```

3. Click **Execute action**.

Your new property will be added to the result of the *Load Users* action as well as to the list of table columns. All components connected to this action will now also receive a new data set.

{% hint style="info" %}
You may need to regenerate the structure of your component for the new property to appear.
{% endhint %}

Now, you can add another column to the table that will display the Full name of the user. You can also change the order of the columns and hide the ones that display First and Last name separately.

{% embed url="<https://demo.arcade.software/FraqhELNIQADHoo3rcfr?embed=&embed_desktop=inline&embed_mobile=tab&show_copy_link=true>" %}

That's it! Now let's proceed to the [next step](/build-from-scratch/getting-started/change-component-data.md) and find out how you can change your component data.

***

If you want to learn more about data mapping and transforming, have a look at this article :point\_down:

{% content-ref url="/pages/FlXv8DDV9LepOxZWK1Z5" %}
[Data mapping & transforming](/build-from-scratch/getting-started/transform-data-with-javascript/mapping-and-transforming-data.md)
{% endcontent-ref %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.uibakery.io/build-from-scratch/getting-started/transform-data-with-javascript.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
