Reputation: 1055
I'm working with this page: ITEM INFO
and I turn the page into a string:
var info = document.getElementsByTagName("pre")[0].innerHTML;
The entire page is already in the format of an array, so is there a conversion function that will convert it from the string into an array?
Upvotes: 2
Views: 111
Reputation: 11061
Use JSON.parse(info)
to parse JSON text into Javascript Array.
var info = document.getElementsByTagName("pre")[0].innerHTML;
var results = JSON.parse(info);
Now in results
variable will be an array of parsed JavaScript objects.
Upvotes: 2