Is there an easy solution to handle this specific situation
var data = {
"phone": input
}
var payload = JSON.stringify(data);
When the payload is utilized in an API call and the API specifically requires the phone value to be a string, despite phone numbers being accepted as either numbers or strings e.g. 123777777 or 1237-77777 etc
I attempted to use quotes, but JSON.stringify escapes them resulting in them becoming part of the final data.
The 'trick' I discovered was to add an extra space at the end i.e.
var data = {
"phone": input + " "
}
However, I am curious if there exists a straightforward and tidy way to handle this particular scenario?