Hi all,
i’m building an FME desktop workspace for eventual use with a server automation. we’re taking some emails, parsing them for some specific data, reading text files with additional information, and then putting it all together to be sent out via an API for a software called Desk Alerts.
Where i am running into issues is - the text files are UTF-8 encoded and contain line feeds and tabs that the API isn’t happy with.
so for instance i might have a message that looks like:
now you can see i’ve got 4 tabs and almost 20 line feeds.
this text is actually the combined result of several files and the content is variable so for readability’s sake maintaining the line feeds (and preferably the tabs) is paramount.
When sending to the API, i get the following error response:
{"status":"Error","errorMessage":"Request model invalid","data":
{"validationErrors":t"oqueryParam] : The queryParam field is required.","r$.body]
: '0x0A' is invalid within a JSON string. The string should be correctly escaped.
which if i am understanding it correctly is essentially “we don’t like those line feeds. escape them correctly!
so in my workspace i put in a string replacer, since it appears that the proper escape needs 2 slashes:
however, while this satisfies the API, instead of including a new line, it just includes \n where the line feeds used to be.
The enhanced alarm included the following information and instructions:\n\n \n********************************************************************************\n \n
I'm not sure how to approach this while maintaining individual lines.
i’d appreciate any insight.