Format Data
Turn data (objects or arrays) into a readable string using a template. Use {{@field}} placeholders to reference fields from your data. 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 {{@field}} placeholders to reference fields from your data. 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. Can use workflow variables like {{root.result.triggeredAt}} which will be resolved before formatting. The result becomes the data source for template placeholders. |
template | string | Yes | Template with {{@field}} placeholders. IMPORTANT: Use @ prefix to reference data fields (e.g., {{@name}}, {{@user.email}}). The @ prefix distinguishes template-local variables from workflow variables (like {{root.result.x}}) |
separator | string | No | Separator for array items (default: newline) |
Result Schema
| Field | Type | Required | Description |
|---|---|---|---|
formatted | string | Yes | Formatted string result |
Examples
json{ "type": "format", "payload": { "data": { "triggeredAt": "{{root.result.triggeredAt}}", "price": "{{root.result.price}}" }, "template": "{{@name}} is {{@age}} years old" }, "children": []}
bashcurl -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" }}'
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.
