I have defined a class Email having following details:
Email:
String name;
String subject;
List<String> attachment;
String jsonContent;
....
In above class, jsonContent variable is loaded with a strinigified json object.
Once an Email object is created, I am stringifying the whole Email object and sending to client.
I need to parse Email object in client and render it in UI.
But it throws parsing error for Email object in client, i.e.
JSON.parse(emailString);
because jsonContent field is having double quotes within it.
It is a problem of stringifying a JAVA object having a jsonContent variable which is already stringified.
One way to fix it is define jsonContent variable as a object rather than as a String.
Is there any other fix for it?
Example Email JSON:
{
"id": "e4682ec0-a7c3-4f4d-abcd-f404f5fdb1eb",
"entityType": "email",
"subject": "Presentation 1",
"from": "aaa <[email protected]>",
"to": [
"undisclosed-recipients:;"
],
"cc": [],
"bcc": [
"[email protected]"
],
"recievedDate": 1423101398000,
"recievedDateString": "Wed, 4 Feb 2015 12:26:38 -0800",
"bodyText": " Please find the link to my recent presentation",
"jsonContent": "{
"typeOfMail": "NormalMail",
"normalMail": {
"mailType": "NormalMail",
"paragraphs": [
"Pleasefindthelinktomyrecentpresentation"
]
}
}"
}
jsonContentin Java and in the browser? If you provide more detail, it will allow someone to help.\\\"