Layer7 API Management

  • 1.  How to convert JSON Array element to recurring XML tags

    Posted Oct 26, 2016 05:14 AM

    Hi,

     

     I want to convert following JSON to XML:

     

    Input JSON

    =====

    {
    "services" : [
    "DIGITIZATION","ENCRYPTION","DECRYPTION"
    ],

    }

     

    Required outpu XML Format

    ===============

    <services>

    <service>DIGITIZATION</service>

    <service>ENCRYPTION</service>

    <service>DECRYPTION</service>

    </services>

     

    Please note that numbe of element in JSON array may vary and accordingly number of recurring tags (<service>) need to be formed in output XML structure. Not finding a way to do it. Please help.

     

    Thanks,

    Siddharth



  • 2.  Re: How to convert JSON Array element to recurring XML tags
    Best Answer

    Broadcom Employee
    Posted Oct 26, 2016 11:05 AM

    Hi Siddharth,

     

    This seems to be a good use case for the Apply JSON Transformation assertion. I have linked to the documentation below along with a screenshot of the sample output.

     

     

    Apply JSON Transformation Assertion - CA API Gateway - 9.1 - CA Technologies Documentation