2

I am trying to add new lines from a text area, but when I send the data to the API in json format folowing is the format.

{
   day: "2018-07-30"
   notes: "Enter↵New↵Lines↵in↵Textarea↵"
   time: "4"
}

as you can see in the given object "notes" property has a special character added for enter. How to handle this json format and again populate it to matTooltip with new lines.

Expected output:

Enter
New
Lines 
in
Textarea

Current Output: Enter↵New↵Lines↵in↵Textarea↵

  • 2
    Possible duplicate of [How do I handle newlines in JSON?](https://stackoverflow.com/questions/42068/how-do-i-handle-newlines-in-json) – Tim Martens Aug 06 '18 at 09:18
  • Hi @TimMartens that example doesn't solves my problem. I have already tried that approach. – prakarsh gupta Aug 06 '18 at 09:20
  • how about replacing the charater `↵` by a `CRLF/LF` character using [string.replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) when you `GET` the datas ? – jonatjano Aug 06 '18 at 09:23

0 Answers0