In JS : I have this string =”[36.79025,3.01642],[36.71477,2.99761]”; I want it to be turned To a real Array =[[36.79025,3.01642],[36.71477,2.99761]]; Is this possible?
Advertisement
Answer
var string = "[36.79025,3.01642],[36.71477,2.99761]"; var arr = JSON.parse(`[${string}]`); console.log(arr);
[[36.79025,3.01642],[36.71477,2.99761]]