Converting a number to a string

Hi!

Can you tell me how I can convert a number to a string and back?
I take data from two sources, they are the same, but the type of value is different, so the equivalence check does not work.

1 Like

Hey @a1ekseev!

Welcome to the n8n community! :slightly_smiling_face:

You can convert a number to a string using the .toString() method. And to convert the string back to number you can use the parseInt() method.

In the workflow below, I am converting the number to a string, inside the Expression Editor. {{$node["Set"].json["value_number"].toString()}}. This only converts the number to string for checking the values, and the original data type remains the same.

I hope this helps. :slightly_smiling_face:

2 Likes

Now I understand the syntax.
Thank you!

Happy that I could help. :slightly_smiling_face:

Have fun!