JSON number value to string

I’m trying to convert a number value (1) to a string (“1”).

I was expecting the Set function to already take care of this when selecting ‘String’ as the Value to Set. Tried adding “” in the value, as well as Javascript functions String and .toStrring(). And although the example, as well as the output in table form display “1”, the result remains 1 (without the “”). Any idea what I might be doing wrong?

“” + number should do it.

to clarify:

{{ "" + $json.field }}
1 Like

unfortunately, it does not …

Weird, with simple 2 sets after eachother it does work. :thinking:

edit: I just checked if it still works when the field name is the same. This is the case, so something else is going on here.

1 Like

indeed weird … also because the other way around (number to string) works, i.e.

{{ Number($json["id"]) }}

I’m trying to merge two datasets, where the id is dataset A is number and in dataset B is string. Would be nice if the Merge node would ignore the data type and would merge on the content …

Yes, this would be very nice indeed. I have the same issue with a lot of my data sets. I always turn the string into numbers so never noticed any issue with converting them.

Still no idea why the convert to string doesn’t work. have you tried (value).toString() without putting the “” around it?

1 Like

Yes, I think I’ve tried virtually everything :wink:

1 Like

Have you tried with static data?

Might be connected to my issue with the dates:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.