Transform JSON To XML In API Gateway

Hi Everyone,

I am using API Gateway version 10.15 and I am trying to transform my response from JSON to XML using XSLT in response processing policy. But my response is always in json despite of my payload. How can I transform my JSON response to XML. This is my XSLT.

<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:strip-space elements="*"/>
  <xsl:output method="xml"/>
    <!-- Identity transform -->
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="*[not(node()) or text() = 'null']"/>
</xsl:stylesheet>

What is the value passing in Accept header parameter in the request and give us the details about response policy defined for the API?

See if this tutorial helps.

It shows how json is transformed using XSLT.

https://youtu.be/h670ZpoC-Zc

1 Like

Hi @franklinantony,

Thank you for your response but this is JSON to JSON transformation. We need to transform JSON to xml

Similar topic covered here : WM API Gateway - Request Transformation Payload - From JSON to XML? - #10 by rmg

HTH
Bharath

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.