-2

I want to turn this into an array

"["65747add-afd2-45b5-92e0-150bbe40e6d9", "9c247ea5-6b81-4f47-a50c-42367dedd50b", "c1555363-aca9-4e04-8844-e0180397c72e"]"

I am getting it from the page like this:

$('#layout-uuids').text()

Is there away to just get it as an array or do I need to turn the string into an array somehow?

Thanks!

BC00
  • 1,479
  • 2
  • 25
  • 43

1 Answers1

1

That string looks like JSON. If it is indeed JSON, all you need is JSON.parse():

var someArray = JSON.parse($('#layout-uuids').text());
Matt Ball
  • 344,413
  • 96
  • 627
  • 693