Hi All,
Input code: a!toJson( value: {test: { assuranceText: "Jag försäkrar att uppgifterna jag har lämnat är riktiga och bekräftar att jag har tagit del av informationen och villkoren ovan.\n\nDin ansökan grundas på automatiserad behandling av dina personuppgifter. På vår hemsida och under inställningar kan du läsa mera om hur vi behandlar dina personuppgifter och om dina rättigheter.\n\nNär du skickar in din ansökan kommer en kreditupplysning om dig att hämtas in ifrån UC" } }, removenulloremptyfields: true())
I am geeting the out put as below: in the output you can observer that one extra backword is added for the newline character
Discussion posts and replies are publicly visible
Your input doesn't have "newline characters" as far as a!toJson() is concerned, it just has the text "\n". So when you call a!toJson() on your original string, it's escaping your "\n" characters to "\\n", because it has no way of knowing you don't want it to preserve those as plaintext.
Hi Mike, the idea is in a json string we want to send "\n" in between the text so that other systems (built on different technology) will interpret it as new line and show the message with line breaks. so wanted to know how get the output from toJson("\n") as "\n" instead of "\\n"
The first thing i'd try is to pre-sanitize it so that a!toJson() treats the newlines like newlines:
a!toJson( value: { test: { assuranceText: substitute(ri!input, "\n", char(10)) } }, removenulloremptyfields: true() )
nice idea