I am using the official JSON library for my java project project, I noticed something strange.
If I have json, for example:
{
"text": "This is a multiline\n text"
}
And I'm trying to get a string like this:
System.out.println(jsonObject.getString("text"));
I get this in the output:
This is a multiline\n text
Instead:
This is a multiline
text
Does anyone know the correct way to handle special characters like \ n and \ t? I could always replace each, but I would have to process everything one at a time.
source
share