> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Format Data

Turn data (objects or arrays) into a readable string using a template. Use {{@field}} placeholders to reference fields from your data, or {{@}} for arrays of plain values such as the output of Extract Field from Array. For number formatting (commas, currency), use the Run JavaScript action instead.

Built-in action Built In

Turn data (objects or arrays) into a readable string using a template. Use &#123;&#123;@field&#125;&#125; placeholders to reference fields from your data, or &#123;&#123;@&#125;&#125; for arrays of plain values such as the output of Extract Field from Array. For number formatting (commas, currency), use the Run JavaScript action instead.


## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `format` |
| Category | Built In |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | `utility`, `formatting`, `string`, `template`, `data-processing` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `array \| object` | Yes | Data object or array. An array may hold objects, whose fields the template reads by name, or plain values like addresses or symbols, which the template inserts with &#123;&#123;@&#125;&#125;. Can use workflow variables like &#123;&#123;root.result.triggeredAt&#125;&#125; which will be resolved before formatting. The result becomes the data source for template placeholders. |
| `template` | `string` | Yes | Template with &#123;&#123;@field&#125;&#125; placeholders. IMPORTANT: Use @ prefix to reference data fields \(e.g., &#123;&#123;@name&#125;&#125;, &#123;&#123;@user.email&#125;&#125;\). The @ prefix distinguishes template-local variables from workflow variables \(like &#123;&#123;root.result.x&#125;&#125;\). When the data is an array of plain values rather than objects — what Extract Field from Array returns — write &#123;&#123;@&#125;&#125; for the value itself, since a string or a number has no field to name. |
| `separator` | `string` | No | Separator for array items \(default: newline\) |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `formatted` | `string` | Yes | Formatted string result |

## Examples

**Workflow node**

```json
{
  "type": "format",
  "payload": {
    "data": {
      "triggeredAt": "{{root.result.triggeredAt}}",
      "price": "{{root.result.price}}"
    },
    "template": "{{@name}} is {{@age}} years old"
  },
  "children": []
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/format/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "data": {
      "triggeredAt": "{{root.result.triggeredAt}}",
      "price": "{{root.result.price}}"
    },
    "template": "{{@name}} is {{@age}} years old"
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.