Integration

Get Involved. Join the Conversation.

Topic

    Noam Tamarkin
    OIC - handling nested Json array is failing when internal...
    Topic posted November 14, 2019 by Noam Tamarkin, tagged Cloud, Integration, Mapping 
    17 Views, 3 Comments
    Title:
    OIC - handling nested Json array is failing when internal array is empty
    Summary:
    OIC - handling nested Json array is failing when internal array is empty
    Content:

    Hi,

     

    I have a service provider response that should be mapped as-is to the OIC integration response.

    I used a straight forward mapping.

    If the nested array ("LineList") is empty, I get the following error:

    {
      "type" : "10.5.3",
      "title" : "exception occurred while translating the response into the accepted media type.",
      "detail" : "oracle.cloud.connector.api.CloudInvocationException: ORABPEL-15236\n\nTranslation Failure.\nFailed to translate XML to JSON. Cannot write end element: PlatformId\nThe data does not conform to the NXSD schema. Please correct the problem.\n",
      "o:errorCode" : "TRANSLATION-ERROR-01",
      "o:errorDetails" : [ {
        "type" : "NA",
        "instance" : "NA",
        "title" : "NA",
        "o:errorPath" : "NA",
        "o:errorCode" : "NA"
      } ]
    }
    

     

    The Json sample is in the code Snippet below.

     

    Thanks,

    Noam

    Version:
    Version: 19.3.3.0.0 (190924.1600.31522)
    Code Snippet:

    Comment

     

    • Hemanth Lakkaraju

      Per my understanding, you should not get this error if LineList array is empty because the error message talks about 

      Cannot write end element: PlatformId
      

      which is outside LineList. So my guess your mapping may be incorrect or you are missing the element in one of the array objects.

      • Noam Tamarkin

        Hi,

         

        Thanks for the fast answer.

        That is my bad.

        I corrected it and it is working now.

        BTW, do you know how to return empty array as []? Currently when array is empty is return empty string.

        Thanks,

        Noam