ImportMapping: parse value containing a control character to string

0
Got an importmapping that parses a string into an object with several attributes. Works fine until one of the attributes contains a line break. Then it fails with the message   Exception: Error parsing JSON. Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value at [Source: (com.mendix.integration.model.stream.StoredByteArrayInputStream); line: 2, column: 86] at ServiceEmailv0.UT_ImM_Email_WithlinebreakInPlainBody (Import with mapping : 'Import from JSON') Advanced stacktrace: com.mendix.modules.microflowengine.MicroflowException: Error parsing JSON. Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value at [Source: (com.mendix.integration.model.stream.StoredByteArrayInputStream); line: 2, column: 86] at ServiceEmailv0.UT_ImM_Email_WithlinebreakInPlainBody (Import with mapping : 'Import from JSON') etc.... I tried to add a conversion-microflow to the particular attribute in the mapping, but it does not even get there. Any idea how to import the PlainBody when it has a linebreak?
asked
1 answers
1

As the error message says, line breaks are not permitted in strings and must be escaped. https://www.json.org/json-en.html

Do you control the JSON source? It looks like it’s been built using string concatenation rather than an export mapping (or equivalent if not using Mendix). Can you change it there to generate correct JSON? 

answered