I have an PSCustomObject, I want to convert to xml using powershell. When I convert using ConvertTo-Xml
,
I am using following command to convert
$test = ConvertTo-Xml -As String -NoTypeInformation -InputObject $data
It is converting to xml in below format.
<?xml version="1.0" encoding="utf-8"?>
<Objects>
<Object>
<Property Name="ABC">1</Property>
<Property Name="PQR">2</Property>
<Property Name="XYZ">3</Property>
</Object>
</Objects>
whereas I want to be in below format.
<?xml version="1.0" encoding="utf-8"?>
<Objects>
<Object>
<ABC>1</ABC>
<PQR>2</PQR>
<XYZ>3</XYZ>
</Object>
</Objects>
How can I do this?