Data Converter
Convert between various data formats - Base64, Binary, JSON, XML, YAML, CSV, HTML, and more
Actions49
- Base64 Actions
- Binary Actions
- Encoding Actions
- Format Actions
- HTML Actions
- String Actions
Overview
The "Normalize Whitespace" operation in the String resource of this Data Converter node cleans up extra spaces, tabs, and line breaks in a given text input. It standardizes whitespace usage by removing redundant or irregular spacing, making the text more uniform and easier to process or display.
This operation is useful in scenarios where input text may contain inconsistent spacing due to user input, copy-pasting from various sources, or formatting issues. For example, cleaning up text extracted from PDFs, emails, or scraped web content before further processing or storage.
Practical examples:
- Removing multiple spaces between words and replacing them with a single space.
- Converting tabs and newlines into single spaces or normalized line breaks.
- Preparing text for consistent display in UI elements or reports.
Properties
| Name | Meaning |
|---|---|
| Input Data | The text string whose whitespace you want to normalize (clean up extra spaces, tabs, and line breaks). |
Output
The output is a JSON object containing a single field:
result: A string representing the input text after normalizing whitespace. All excessive spaces, tabs, and line breaks are cleaned up according to the normalization logic.
No binary data output is produced by this operation.
Example output JSON:
{
"result": "This is the normalized text with clean spacing."
}
Dependencies
- No external services or API keys are required.
- This operation relies on internal utility functions for string manipulation bundled within the node's codebase.
- No special environment variables or n8n configurations are necessary.
Troubleshooting
- Empty or unchanged output: If the input text does not appear changed, verify that the input actually contains irregular whitespace characters such as multiple spaces, tabs, or line breaks.
- Input type errors: Ensure the "Input Data" property is provided as a string. Non-string inputs may cause unexpected behavior.
- Large text inputs: Very large text inputs might impact performance; consider splitting input if needed.
Common error messages:
- Errors related to invalid input types or missing required parameters will be thrown by the node framework. Make sure the "Input Data" property is set and valid.