Reputation: 51
I am taking data from the multiple select that gives me an array data. The data that I am getting is
{provinces: "["1","2"]"}
and when I stringify this data I got
{"provinces":"[\"1\",\"2\"]"}
But what I really want is
{"provinces":["1","2"]}
is there any way ?
Upvotes: 0
Views: 1151
Reputation: 41447
use the JSON.parse
var obj = {"provinces":"[\"1\",\"2\"]"}
obj.provinces = JSON.parse(obj.provinces);
console.log(obj)
Upvotes: 3