I'm trying to parse a string from JSON and turn those elements into an array in Javascript. Here's the code.
var data = "{"fname":"Todd","lname":"James","cascade":"tjames","loc":"res","place":"home", "day0":"0,1,2,3,"}";
var getDay = data.day0;
var getDayArray = getDay.split(",");
Essentially, I'm trying to get day0, which is 0,1,2,3, and turn it into an array with a structure of
[0] = 0
[1] = 1
[2] = 2
[3] = 3
What is the best way to go about doing this?
var data = '{"...."}';data=JSON.parse(data);, etc?