After receiving the payload from another server with query param, which looks like this: "[55]"
, the goal is to convert it into an array using JavaScript.
The conversion process involves the following steps:
var termssValidation= JSON.parse(JSON.stringify(event.termsQuery));
However, when attempting to iterate through the converted array using a loop:
for(var t in termssValidation ){
console.log(termssValidation[t]);
}
An unexpected result is obtained, displaying:
[
5
5
]
The question remains: how can this be properly converted into an array format?