I get this String from my database:
Test Action Item ZusammenführenTest Action Item ZusammenführenTest Action Item ZusammenführenTest Action Item ZusammenführenTest Action Item ZusammenführenTest Action Item Zusammenführen
fsd
fsa
df
asdf
as
dfs
fd
sad
f
sadf
sad
Now I need to encode all LineBreaks to \n so I can produce proper JSON objects out of the String because JSON doesn't support linebreaks. How can I detect and replace all LineBreaks in the existing String with \n?
I already tried .replace() and replaceAll(). But I need a way to detect the linebreaks First so I can replace them.
Some additional informations:
After trying out several replace-functions mentioned here the JSON still looks like this:
{ "id": 182,
"status": "eing",
"text": "KORE_AI_6",
"beschreibung": "Eins
Zwei
Drei",
"tags": "KORE"
},
And it should look like
{ "id": 182,
"status": "eing",
"text": "KORE_AI_6",
"beschreibung": "Eins\nZwei\nDrei",
"tags": "KORE"
},