Layer7 API Management

Expand all | Collapse all

JSON sequencing issue with assertion "Apply JSON Transformation"

Jump to Best Answer
  • 1.  JSON sequencing issue with assertion "Apply JSON Transformation"

    Posted 05-08-2017 11:34 PM

    XSLT can be used as a workaround to get the xml sequencing correct.

    What about XML to JSON, have anyone faced similar sequencing issue in JSON output?
    I am seeing an issue, where the JSOn output fields are not in sequence after using "Apply JSON Transformation" assetion, with "xml to Json" selected.

     

    One of my client is looking for solution, if there is any sequencing issue with XML to JSON  using "Apply JSON Transformation" assertion.



  • 2.  Re: JSON sequencing issue with assertion "Apply JSON Transformation"

    Posted 05-09-2017 12:58 AM

    Did you try Changing transformation convention from standard to JSONML



  • 3.  Re: JSON sequencing issue with assertion "Apply JSON Transformation"
    Best Answer

    Posted 05-09-2017 08:57 AM

    From the JSON spec at http://json.org:

     

    An object is an unordered set of name/value pairs.

     

    However, the XML schema might be imposing an order which the conversion from JSON might not respect; which seems to be the issue you're encountering. So for this, which it seems like you're aware of already, we have a workaround. You can apply a XSL Transformation to the policy to order things how you want as our Gateway doesn't preserve the element order. 

     

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

     

    -Alec Daniello

    APIM Support



  • 4.  Re: JSON sequencing issue with assertion "Apply JSON Transformation"

    Posted 05-12-2017 01:00 AM

    Hi,

    I have used "Apply JSON Transformation" assertion for JSON to XML conversion followed by xslt.

     

    Now trying to convert XML response to JSON with proper sequence using XSLT.

    Is there any custom xslt available to use it or any sample would be useful.

     

    Rudra Singh