AnsweredAssumed Answered

JSONSetElement is creating numbers out of text fields

Question asked by andypieman on Oct 27, 2017
Latest reply on Oct 28, 2017 by wimdecorte

I'm not sure this is a bug, but it is definitely reproducible.

 

I am writing to WooCommerce a WordPress plug in. For some reason this needs to take prices as a text strings. I have a text field in my DB that has the price in with just numerals and separators. When this field is used in a JSONSetElement it gets converted to a number and therefore causes an error "regular_price is not of type string".

 

Testing seems to indicate that if a text field starts with a numeral JSONSetElement sets it to a number and removes the text. The field is definitely a text field, and even if you use the expression GetAsText<field> it still converts to a number. Quote(<field>) does work, as does just putting quotes directly in the field, but this seems like a bit of a workaround.

 

Does anyone have any experience of this?

 

Screen Shot 2017-10-27 at 12.48.35.pngScreen Shot 2017-10-27 at 12.48.05.pngScreen Shot 2017-10-27 at 12.56.08.png

Outcomes