Skip to Content
0
Jan 22, 2020 at 08:30 AM

How to fromat REST payload

158 Views

Hello,

we are facing a problem with REST receiver. We are doing the standard transformation in the REST adapter from XML to JASON. Before this we are doing an mapping for some special fields which are causing this error:

"project":"{\"key\": PLAYCOMPL}",

Does any one knows how we can remove the \ in this payload?

This is the full message after the mapping and after the REST receiver has processed it:

{"CreateIssue_In_MT":{

"project":"{\"key\": PLAYCOMPL}",

"issuetype":"{ \"name\": Complaint}",

"resolution":"{ \"name\": Incomplete}",

"priority":"{ \"name\": Major}",

"summary":"Create Issue Test 2",

"description":"Creating of an issue using project keys and issue type names using the REST API",

"customfield_15513":"[ { \"value\": No}]",

"customfield_15509":"[{ \"value\": TEST}]",

"customfield_15506":"[{ \"value\": TEST}]",

"customfield_15503":"[{ \"value\": Financial Institutions}]",

"customfield_15528":350,

"customfield_15514":351,

"customfield_15529":352,

"customfield_15523":353,

"customfield_15530":"Sales Organization",

"customfield_15525":"Purchase Order Number",

"customfield_15507":"{\"name\": test}]",

"customfield_15512":"TEST",

"customfield_15527":"2018-01-09",

"customfield_15517":"ABCDE",

"customfield_15504":123456,

"components":"{\"name\": TEST}]"}

}

We would need something like this:

{"CreateIssue_In_MT":{

"project":{"key": "PLAYCOMPL"},

"issuetype":{"name": "Complaint"},

"resolution":{"name": "Incomplete"},

"priority":{"name": "Major"},

"summary":"Create Issue Test 2",

"description":"Creating of an issue using project keys and issue type names using the REST API",

"customfield_15513":[{"value": "No}],

"customfield_15509":[{"value": "TEST"}],

"customfield_15506":"[{"value": "TEST"}],

"customfield_15503":[{"value": "Financial Institutions"}],

"customfield_15528":350,

"customfield_15514":351,

"customfield_15529":352,

"customfield_15523":353,

"customfield_15530":"Sales Organization",

"customfield_15525":"Purchase Order Number",

"customfield_15507":{"name": "test"}],

"customfield_15512":"TEST",

"customfield_15527":"2018-01-09",

"customfield_15517":"ABCDE",

"customfield_15504":123456,

"components":[{"name": "TEST"}]}

}

Regards
David