Overview
This node, named "Formatador de Texto" (Text Formatter), is designed to add a prefix and/or suffix to input data fields. It processes each incoming item by extracting a specified field's value, then concatenates the user-defined prefix and suffix strings around this value. This is useful for formatting text data dynamically within an n8n workflow, such as preparing identifiers, labels, or messages by adding consistent prefixes or suffixes.
Practical examples:
- Adding country codes as prefixes to phone numbers.
- Wrapping usernames with special characters for display purposes.
- Appending units (e.g., "kg", "cm") to numeric values stored as strings.
Properties
| Name | Meaning |
|---|---|
| Prefixo | Text to be added at the beginning of the input data field. |
| Campo De Dados | The name of the input data field to format; can also be an expression enclosed in {{}}. |
| Sufixo | Text to be added at the end of the input data field. |
| Campo De Saída | The name of the output field where the formatted result will be stored. |
Output
The node outputs an array of items where each item's JSON contains all original fields plus a new field (named as per the "Campo De Saída" property) holding the formatted string.
Example output JSON structure for one item:
{
"originalField1": "...",
"originalField2": "...",
"texto_formatado": "prefix + originalValue + suffix"
}
If the input field is not specified, the entire input JSON object is stringified and used as the base for formatting.
No binary data output is produced by this node.
Dependencies
- No external services or API keys are required.
- The node relies on standard n8n workflow methods and expression evaluation capabilities.
Troubleshooting
- Empty or missing input field: If the specified input field does not exist in the incoming data, the node will use an empty string as the base for formatting.
- Expression errors: When using expressions in the "Campo De Dados" property, ensure they are correctly formatted with
{{ }}and valid JavaScript expressions; otherwise, evaluation may fail. - Error handling: If an error occurs during processing and "Continue On Fail" is enabled, the node will output the error message in the JSON of the affected item under an
errorfield. Otherwise, it will stop execution and throw an error indicating the item index.