Handling 'New Line' in Text Body

28 views
Skip to first unread message

Sean J. Bao

unread,
Dec 2, 2021, 9:54:42 AM12/2/21
to Tasker
I have created a task to forward received sms to a server. I read sms body from %SMSRB%. If there is a line break in sms, I will get something like 'test\nnew line'. But this is an invalid string when parsing in JS using JSON.parse. The string need to be processed to 'test\\nnew line'. Could someone provide a method in tasker to process such scenario? Or do I have to process this manually in my JS program before calling JSON.parse? Thanks.

ktmom

unread,
Dec 3, 2021, 7:54:12 AM12/3/21
to Tasker
I would use a search/replace action and change \n to \\n.
Reply all
Reply to author
Forward
0 new messages