Passing strings containing just numbers in a mustache expression, alway casts back to some number type

Hi, I currently have a setup, where I use Text Inputs to pass/set Parameters in REST Queries. These Parameters have to be of type String. Now here comes the problem. Whenever I have an input consisting of numbers only, it will be converted to some numeric type, leading to a bad request error.

“idInput” is an Input Widget set to be of data type “Text”, which is passed to a REST request. The REST body is set up to take the input of widget via Mustache expression, something like:

“id”: {{idInput.text}},

When the value of ID is something like “12EF567” its evaluated to string and the request is fine, but if the ID is “1234567”, i get an error, telling me “[id must be of type String]”.

the request body evaluates to:

“id”: “1234567”,

Now I have already tried several things like:

“id”: {{idInput.text.toString()}} → evaluates to “id”: “1234567” → still wrong type error.
“id”: "{{idInput.text}} → evaluates to “id”: “1234567” → still wrong type error.
“id”: "{{idInput.value}} → evaluates to “id”: “1234567” → still wrong type error.
“id”: "{{idInput.value.toString()}} → evaluates to “id”: “1234567” → still wrong type error.

The only thing that currently works is directly putting the string into the request:

“id”: “1234567” → evaluates to “id”: “1234567” → success!

I think there is some kind of Bug or automatically casting values Numbers, but I’m not sure if I just use the Mustache expressions wrong.

Thanks in advance for your help :slight_smile:

Hello David! I’m sorry that you are facing this issue. Could you please check if Smart JSON Substitution is enabled in your API Settings? If so, could you try if it works with it disabled?

It was disabled.
But I found a solution. Disabling Encode Query Params, an then putting all strings in ""fixes the issue.

I am glad it’s fixed now. Thank you for sharing the solution.