Loading

Trailing Zeros Trimmed in DataWeave 4.5 Runtime and above: Expected Behavior and Workaround

Fecha de publicación: Sep 18, 2025
Descripción

The user encountered an issue where zero decimal parts in numeric values were being truncated in the transform message when using Mule runtime 4.5 and above. This behavior violated API contracts that required double-type numbers to retain trailing zeros, such as 10.00 or 180.00.

The root cause of the issue is a change introduced in Mule 4.5 runtime and above, where the DataWeave component was updated to trim trailing zeros in numeric values. This behavior aligns with the JSON specification for the number data type, which does not preserve insignificant trailing zeros.

Reference: Mule 4.5 Release Notes 

"Trailing zeroes after the decimal point are now removed by default for JSON, YAML, CSV, and DataWeave formats."

Solución

1. Use a runtime argument to retain trailing zeros by setting the following property: -Dcom.mulesoft.dw.stripTrailingZeroes=false.

2. Set 'minMuleVersion' to '4.4.0' in artifact.json to retain DataWeave behavior from version 4.4, even when running on newer runtimes.

Número del artículo de conocimiento

005208317

 
Cargando
Salesforce Help | Article