# 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](https://docs.uibakery.io/build-from-scratch/getting-started/change-component-data) 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="transform-data-with-javascript/mapping-and-transforming-data" %}
[mapping-and-transforming-data](https://docs.uibakery.io/build-from-scratch/getting-started/transform-data-with-javascript/mapping-and-transforming-data)
{% endcontent-ref %}


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
