My response is xml and looks something like this:
<res:ShipmentResponse xmlns:res=‘xxxxxx’>
2022-07-20T13:32:58.845+00:00
07ca1454e7e34da0a7b973defd6dddec
xxxx
</res:ShipmentResponse>
I want to parse to get SiteID.
I tried this:
var jsonObject = xml2Json(responseBody.Body);
console.log(jsonObject);
console.log(jsonObject.ShipmentRequest.Response.ServiceHeader.SiteID): → wanted this
console.log(jsonObject.ShipmentRequest); → this give object undefined because of “res”
console.log(jsonObject.res:ShipmentRequest); → this has syntax error
How do I write “res:ShipmentRequest” so that it works?