2

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?

1 Answer 1

2

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.

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

1 Comment

Can you edit that to show how I would apply that? Im a bit of a noob to this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.