Is there a simple way to deal with this example situation
var data = {
"phone": input
}
var payload = JSON.stringify(data);
In the situation where the payload is used in an API call and the API demands that phone value is a string, however, phone numbers can just be entered as numbers or strings e.g. 123777777 or 1237-77777 etc
I tried adding quotes, but JSON.stringify escape them so the end up being part of the final data.
The 'hack' solution I found was to add a trailing space i.e.
var data = {
"phone": input + " "
}
But want to know if there is a simple and neat way to deal with this scenario?