If you display (or paste) the json value directly in HTML, you cannot use it the way it happens, because in html newlines are ignored and replaced with a space.
For example, if you have:
<p>Hello, I'm in other line.</p>
It will be presented as:
Hi, I'm on a different line.
You must convert newlines to paragraph or <br> , for example:
<p>Hello,<br> I'm in other line.</p>
This will be shown as:
Hello,
I'm on a different line
If this is your case, you can simply use String.replace to change \n to <br>\n .
source share