*****No JQUERY*****
I have a string passed into my Javascript that looks like below. I want to convert it into an array.
I have
{"test":"1,180,35"}
I want
an array where index 0 = 1, index 1 = 180, index 2 = 35.
How would I achieve this?
*****No JQUERY*****
I have a string passed into my Javascript that looks like below. I want to convert it into an array.
I have
{"test":"1,180,35"}
I want
an array where index 0 = 1, index 1 = 180, index 2 = 35.
How would I achieve this?
 
    
     
    
    Parse the string, pull out the property value for property test, split it on ,.
var input = '{"test":"1,180,35"}'
var jsObj = JSON.parse(input);
var arr = jsObj.test.split(",");
console.log(arr); 
    
    use JSON.parse() to convert a string into a json object.
But, you are looking to parse a series of numbers into an array, so what you really want is split(",")
 
    
    Use the JSON object
let arr = JSON.parse('{"test":"1,180,35"}').test.split(',');
 
    
    For example:
var yourData = `{"test":"1,180,35"}`
JSON.parse(yourData).split(',')
