Parse XML response to get a value

tibornagy
Sat, 29 Oct 2022 12:12:00 +0000
Help Hub

Hi guys,

I have a POST request and get the following response in XML:

<feed  xmlns="http://www.w3.org/2005/Atom">



    <entry>
        <content type="application/xml">
            <attrs xmlns="http://www.sap.com/rws/bip">
                <attr name="SI_ID" type="integer">302155</attr>
                <attr name="SI_NAME" type="string">TEXT</attr>
            </attrs>
        </content>
    </entry>
</feed>

I would like to parse this response (in Tests script) to get the “SI_ID” value 302155:

console.log(xml2Json(pm.response.text()));

I get “Undefined” error message.

Thanks,
Tibor

3 posts - 2 participants