Author Posts

March 31, 2017 at 2:28 pm

I am pretty new to PowerShell. I am having an issue converting returned XML from Fogbugz to a CSV file. It looks like the issue is in most of the fields the string is wrapped in.

Below is the command I am using.

$resp = Invoke-RestMethod $url
$resp.response.cases.case | ConvertTo-csv

Sample from output ("xxxx" removed information):
"ixBug","operations","sTitle","sStatus","sVersion","sPersonAssignedTo","sFixFor","sPriority","tags"
"xxxxx","xxxxx","System.Xml.XmlElement","System.Xml.XmlElement","","System.Xml.XmlElement","S
ystem.Xml.XmlElement","System.Xml.XmlElement","System.Xml.XmlElement"
"xxxxx","xxxxx","System.Xml.XmlElement","System.Xml.XmlElement","","System.Xml.XmlElement","S
ystem.Xml.XmlElement","System.Xml.XmlElement","System.Xml.XmlElement"

April 2, 2017 at 12:42 pm

Hi

I'd be interested to know if you run $resp.response.cases.case without converting to CSV, do you see the data as you expect it to look?
The !CDATA flags are just there to tell the XML parser "Look at this stuff like regular text" so that it doesn't accidentally parse something that might look like an XML tag when it isn't, so it shouldn't be causing you any trouble. The CDATA content should just end up as the value of the corresponding key.

Liam