[Solved] Convert an Array Object that is a String [duplicate]
Your input is structured as JSON. You can thus simply use any JSON parsing method or library. For example JSON.parse(stringArray) (documentation). Here is a snippet which uses JSON.parse: var stringArray = “[[1,2,3,4],[5,6,7,8]]”; var parsedArray = JSON.parse(stringArray); $(‘#first’).html(parsedArray[0].toString()); $(‘#second’).html(parsedArray[1].toString()); <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> First element: <span id=”first”></span><br> Second element: <span id=”second”></span> You can also use the eval function … Read more