0

I have a Javascript object:

{
    "answers": "[0,0,0,0,1]"
}

I want to convert the answer string to an array:

var array = [0,0,0,0,1]
0

1 Answer 1

1

Use the Json.parse()function for that.

const answers = "[0,0,0,0,1]"
console.log(JSON.parse(answers))

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.