Loading

Read a TAB delimited text file in Mule 4

Publiceringsdatum: Aug 4, 2025
Uppgift

GOAL

To be able to read a TAB delimited text file in order to have the proper payload, allowing you to convert it to JSON, CSV, Java, use it inside a Web Service, etc.
Steg
In order to read a TAB delimited payload, you need to configure the TAB delimited in the file reader, to let the connector handle this and output a Java payload already separated by TABs.

For example:
<file:read doc:name="Read" path="input.txt" outputMimeType='application/csv; separator="&#9;"'/>

The previous code set the separator as TAB by using its HTML code &#9; between quotes and reads the input.txt file.

You may use a Transform Message after the file reader to change it to JSON, CSV or do what you want with it.


Note: 
  • The separator must be "&#9;" in the XML generated by the flow for representing tabs. When entering the value from UI, the studio may convert "&" to its character reference leading to unexpected behavior. Please take care of the same.
  • For more information on how to do this in Mule 3, search for the article "How to use a TAB character as the CSV separator for input in DataWeave" since the perspective is very different.
Knowledge-artikelnummer

001117176

 
Laddar
Salesforce Help | Article