I am generating json from email in Outlook using VBA.
The content of Meetingitem.Body
includes newlines. When I include this content in my json as a string, I get an error.
Is it possible to avoid this?
{"fields": {
"project": {
"id": 30611
},
"summary": "Release Produktion-System",
"description": "Guten Tag
Sie erhalten diese Terminanfrage weil Ihnen im Change 2018.04.24.015 <http://pww.post.ch/appl/oe/it/changemanagement/wpl/pages/editchange.aspx?changeId=29774> die im Betreff aufgeführte Tätigkeit zugeordnet wurde. Bitte bestätigen Sie die Terminanfrage im Outlook, damit für die Ausführung der Tätigkeit der entsprechende Zeitraum in Ihrem Kalender reserviert wird.
(Unter offene Termine die entsprechende Tätigkeit mit Bearbeiten öffnen, und den Status anpassen. Es stehen Ihnen folgende Abschlussstatus zur Verfügung: Erledigt, Verzögert, Abgebrochen).
Freundliche Grüsse
Muster Mus
Musterfirma
Informatik
Telefon: +553344556622
Email: muster.muss@mail.com
",
"issuetype": {
"name": "Test"
}
}
}
It is a POST request to server and here is the response:
{
"errorMessages": [
"Illegal unquoted character ((CTRL-CHAR, code 13)): has to be escaped using backslash to be included in string value\n at [Source: org.apache@4jasdn4; line: 6, column: 28]"
]
}
To generate this json I am using following code (short variant):
Dim smry, descrp, jsTest As String
smry = """summary"""
descrp = """description"""
jsTest = "{" + smry + ":" + """" + CStr(Msg.Subject) + """" + "," + descrp + ":" + """" + CStr(Msg.Body) + """" + "}"