Q: While performing a JSON to EDI conversion, I am unable to convert special characters and a "<" symbol appears as "<". 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. In the following example, MSG contains a less than (<) symbol.
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]}}}"// {{{ }}}here is used so that the special characters 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.~
Comments
0 comments
Please sign in to leave a comment.