Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

I just learned about JSON.parse, I was wondering..

I was wondering if XML.parse or HTML.parse are the two ways of parsing XML and HTML files into Javascript objects?

1 Answer

I'm not sure I understand the question. Can you please clarify? JSON.parse turns a JSON string into an object. Essentially is removes the single quotemarks (') from an expression like '{"somekey":"somevalue"}' to give {"somekey":"somevalue"}. But to do something like that to HTML or XML would not make sense.

I was wondering if there was a way to convert XML, html now that I think about it, but XML into a Javascript object so you may inject that data into your html.