B2B Integration

 View Only
  • 1.  WTX map generating invalid JSON for newline in input XML

    Posted Fri June 04, 2021 04:33 PM
      |   view attached

    Hi,

    I am transforming XML to JSON using WTX 8.4.1.4, wherein in the WTX map I am trying to handle the new line coming as a part of a field value from input xml. To generate a valid json, replacing the new line character (<NL>) with space(<SP>), using SUBSTITUTE function. But, when the map is deployed in DataPower, it generates an invalid json.

    How can we handle new lines in xml, when transforming into json?

    Mentioned below are expected input and output when deployed in DataPower:

    Expected input:

    <message>

    <comments>text

    not

    here</comments>

    </message>

    Expected Output:

    {"comments":"text not here"}

    Mentioned below are current input and output when deployed in DataPower:

    Current Input:

    <message>

    <comments>text

    not

    here</comments>

    </message>

    Current Output:

    {"comments":"text

    not

    here"}

    Error logged in DataPower:

    Invalid JSON document at line 1. Partial content:'{"comments":"text' near #17 character

    Logic used:

    =SUBSTITUTE(comments Comp:ElemDecl message Element:InputXMLCard ,"<NL>","<SP>" )

    Attached the project for reference.

    Thanks in advance :)



    ------------------------------
    Pranjal Deshmukh
    ------------------------------

    #B2BIntegration
    #SupplyChain

    Attachment(s)

    zip
    DemoProject.zip   17 KB 1 version


  • 2.  RE: WTX map generating invalid JSON for newline in input XML

    Posted Mon June 07, 2021 02:57 PM
    8.4.1.4 is longer supported since May, 2020.  You may have to try one that supports at least v9 (ITX latest version is v10.1).  Most of us don't have access to a DataPower box to test a map.  Only the support group does.  So my suggestion is 
    1. Look for at least v9 to test the map.
    2. Open a PMR/case with IBM if v9 doesn't resolve your problem.

    ------------------------------
    Rex Chan
    ------------------------------



  • 3.  RE: WTX map generating invalid JSON for newline in input XML

    Posted Mon July 19, 2021 10:35 AM
    The version is no longer available. You should consider other options, I would suggest you test  v9. Hopefully, It will work well for you.

    ------------------------------
    Emma Watson
    ------------------------------