Layer7 API Management

  • 1.  converting JSON to XML

    Posted Mar 17, 2016 09:18 AM

    Hi All,

       How to convert JSON input to XML and pass the same to backend for getting the result.

     

    Thanks&Regards

    Rajasekhar



  • 2.  Re: converting JSON to XML

    Posted Mar 17, 2016 09:21 AM

    You may want to use



  • 3.  Re: converting JSON to XML

    Posted Mar 17, 2016 09:37 AM

    Thanks Maruti,

        Do i need to use above transformation before route to backend?

        Simple transforming like above will we get the proper response from backend system?

        Where do i need to use RootTag?

    Thanks&Regards

    Rajasekhar



  • 4.  Re: converting JSON to XML
    Best Answer

    Posted Mar 18, 2016 01:20 PM

    Hi Raj,

    Typically this is the sequence in which you use the transformation and invoke the backend if using JSON as input.

     

    -> Transform JSON request to XML using Apply JSON Transformation assertion

    -> Transform the xml to target/backend compatible xml using Apply XSL Transformation

    -> Route to HTTP(S)

    -> Transform the response xml from back end to the xml structure expected by the caller using Apply XSL Transformation

    -> Trim the transformed xml to knock-off the root tag

    -> Transform XML response to JSON using Apply JSON Transformation

     

    The above flow gives utmost flexibility while transforming from JSON to XML and back. Hope its clear.

     

    Regards,

    Trinath



  • 5.  Re: converting JSON to XML

    Posted Mar 28, 2016 05:53 AM

    Sorry for the delay,

    I was in vacation. It really helps alot.

     

    Thank you so much