From the course: Complete Guide to PowerShell 7

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Parsing XML data

Parsing XML data

- [Instructor] Now there are times where you may not want to work with JSON and you may want to use XML because that's the integration that you are using, or the web service may just return XML. Now to do that, we're going to use the same mechanism here, but this time we're adding a different header to anonymous kind of endpoint here, where we're going to specify that it's application XML. So I'm going to select this object here, right click and run selection. So I get a response, and then I'm going to say response run selection. And of course it didn't come back with my dollar sign. So there we go, I've got one now. And it comes back as security events, which means I should be able to type security events and then get an event that comes back like so. And sure enough, there's all my list. Now, depending on the web service, it may just come back in that format. Otherwise you may need to run that and say convert that to an XML document, so strongly type it and then you're able to…

Contents