cancel
Showing results for 
Search instead for 
Did you mean: 

xml to json conversion in receiver soap in sap pi

former_member237514
Participant
0 Kudos

Hi All,

i have issue in XML to JSON array conversion

if there is 1 line item in array Square brackets are not being generated

if there are multiple line items same settings are working fine

we are on 7.4 sp8. and dont have rest adapter

we can use only receiver soap adapter and adapter modules for the entire config.

JSON ARRAY

Message type

  

XML before conversion

<?xml version="1.0" encoding="UTF-8"?>

<ns1:MT_LogError_Reqxmlns:ns1="http://Mahindra.corp/xi/SHIFTB_LogError">

<header>

<linkedAccountId>              0</linkedAccountId>

<sapCreatedAt>08/24/2016 01:19:02</sapCreatedAt>

<complaintSubType>INVALID FILE NAME</complaintSubType>

<description>Filename:CustomerMaster/NewProfiles-23-08-2016.csv-is Invalid</description>

<linkedUserId> 0</linkedUserId>

<linkedJobId></linkedJobId>

</header>

</ns1:MT_LogError_Req>

It is getting converted to the below json structure after conversion

{

"header":

{

"linkedJobId": "",

"linkedAccountId": "              0",

"description": "Filename:CustomerMaster/NewProfiles-23-08-2016.csv-is Invalid",

  "complaintSubType": "INVALID FILE NAME",

"linkedUserId": "                                 0",

"sapCreatedAt": "08/24/2016 01:19:02"

}

}

Required structure

{

  "header":

  [

     {

"linkedAccountId": "",

"sapCreatedAt": "08/23/2016 01:38:09",

"complaintSubType": "FILERETRIEVALERROR",

"description": "Day end reconciliation failure, SmartShift day end balance Rs. 78, SAP day end balance Rs. 85.  UserID XXXXX. Please verify and correct",

"linkedUserId": "4525079564124160",

"linkedJobId": ""

    }

  ]

}

Kindly share your suggestions

Thanks

Kavitha

Accepted Solutions (0)

Answers (1)

Answers (1)

bhavesh_kantilal
Active Contributor
0 Kudos

What is the adapter module you use the XML to JSON conversion? Is it a standard module ( I am not aware of any though ) or is it a custom module?

Regards,

Bhavesh

former_member237514
Participant
0 Kudos

Hi Bhavensh,

below are the screen shot for  configuration in receiver channel module config

level.

former_member237514
Participant
0 Kudos

Any suggestions plz.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Kavi tha,

                    You need your own java mapping or custom adapter module to resolve the issue.

Please provide 1 other case of output json for multiple items, will try to create one.

Regards

Anupam