Add decimal or comma as separator every thousand

Hello, I have API that returns lets sat 8 digit number and I would like to add separators “,” every 000 . How could I do that?

Thank you

You can use .toLocaleString('en-US').

So assuming the data is in the previous node under the property “number” you could use the following expression:

{{ $json["number"].toLocaleString('en-US') }}

The number 12345678 would then be converted into the string 12,345,678.

1 Like

Use Set node and add expression.
Here is an example I did for dollars:
{{($node[“NameofNode”].json[“NameOfValue”]).toLocaleString(‘en-US’,{style:‘currency’,currency:‘usd’})}}