Use the Velocity transformation in a mapping to convert hierarchal input from one format to another without flattening the data. The transformation can convert JSON or XML data to JSON, XML, or text output such as plain text, email, or HTML.
You might want to use the Velocity transformation to convert hierarchical data to comply with a downstream API call or for use in a downstream application such as a campaign management system or machine learning algorithm. You can also use the Velocity transformation to process row data such as a JSON BLOB in a database.
To convert the data, the Velocity transformation uses an Apache Velocity script that you provide. The script can contain Velocity Template Language (VTL) statements, Data Integration built-in functions, and Data Integration unconnected lookup expressions.
You can pass data to the Velocity transformation in one of the following ways:
Pass the data directly to the transformation.
You can pass data directly to the Velocity transformation through the input field. The data must be a JSON BLOB or string or an XML BLOB or string.
Pass the name and location of the file that contains the data you want to convert.
If you want the Velocity transformation to convert data stored in a flat file such as an XML or JSON file, pass the file name and location to the transformation through the input field. The data must be a string that contains the file path and file name. The file must be a delimited flat file that is accessible from the Secure Agent machine.
The transformation returns the converted data in one string field.