I have the following input JSON
{
"listPrice": "1245678.98"
}
I need to format this to the following format
{
"listPrice": "1 245 678,99"
}
Currently i’m being able to do this via the below script
payload.listPrice as Number as String {format: "#,###.##"} replace "," with " " replace "." with ","
Is there a better way to do this, maybe using locales? I tried the Russian and Polish locales, but they didn’t work.
EDIT: I also tried this script
payload.listPrice as Number as String {format: "#####,##", locale: "ru-RU"}
2
payload.listPrice as Number as String {format: "#,###.##", locale: "ru-RU"}
This should be the correct way to do it. I was using the wrong format while trying to convert it to the Russian currency format.
I was using “####,##” instead of “#,###.##”
You are almost there. Try this:
payload.listPrice as Number as String {format: "# ### ###,##"}
instead or replacing your way to the target format.
1