Articles in this section

Errors while converting special characters from JSON to EDI

Q: While performing a JSON to EDI conversion, I am unable to convert special characters and a "<" symbol appears as "&lt;". What is the workaround?

A: You are requested to use {{{[ ]}}} in the Definition File while converting the JSON element to EDI.

The following code snippet illustrates how to use {{{ }}} when there is a special character in the input data. MSG contains a less than (<) symbol in the following example.

Input (JSON)

"MSG": [{
 "Free-Form Message Text": "PREFERENCE IS < PALLET-LOAD, BUT IF CONTAINERS ARE FLOOR-LOADED, 
THEN PLEASE DO CLAMP-LOAD OR STRAIGHT FLOOR-LOAD. 
DO NOT USE SLIP SHEET FOR THIS FC DESTINATION.PAYMENT TERMS ARE PER CONTAINER."
 }]

Definition File

{
 "name": "MSG",
 "description": "Message Text",
 "relativeDataPath": "MSG",
 "maxOccurrence": 50,
 "required": true,
 "elements": [
 {
 "name": "name",
 "value": "MSG"
 },
 {
 "name": "Free-Form Message Text",
 "value": "{{{[Free-Form Message Text]}}}"

// Use {{{[ ]}}}for the special characters to appear as is in the EDI format.
 }
 ]
}

Output (EDI)

MSG*PREFERENCE IS < PALLET-LOAD, BUT IF CONTAINERS ARE FLOOR-LOADED, 
THEN PLEASE DO CLAMP-LOAD OR STRAIGHT FLOOR-LOAD. 
DO NOT USE SLIP SHEET FOR THIS FC DESTINATION.PAYMENT TERMS ARE PER CONTAINER.~
Was this article helpful?
0 out of 1 found this helpful

Comments

0 comments

Article is closed for comments.