I am having the below payload
{
"data": {
"Final_band": {
"min": "229573",
"max": "292184"
}
},
"message": "Engine pricing details fetched successfully"
}
Now I am trying to format the values "min": "229573"
and "max": "292184"
into something like 2,29,573
and 2,92,184
.
The problem is I am trying every solution, but I am not getting the desired result
%dw 2.0
import * from dw::util::Values
var minV = round(payload.data.Final_band.min as Number ) as String {format: "#,##,###"}
var maxV = round(payload.data.Final_band.max as Number) as String {format: "#,##,###"}
output application/json
---
{
"Final_band": {
"min": minV,
"max": maxV
}
}
Firstly, I am rounding off the numeric values, and then I coercing the same into string and then applying format: "#,##,###"
but it outputs the "min":"229,573"
and "max": "292,184"
it is working fine for format: "#,#####"
i,e "min":"2,29573"
and "max": "2,92184"
but when I add more comma(,)
for thousand place, it won't work as expected