I am trying to pass text like
"Video Transmission & internal Recording
No Filters
1x 11 Handheld Monitor 1x 19 Monitor"
--> so 5 and more likes with several empty line inbetween as a single text from make(integromat).com to Lexoffice via HTTP request as ... "description": "ItemDescription" ... with "ItemDescription" being the multi-line long text and I get an error from HTTP Module saying "Error: 400 Bad Request, The request body could not be parsed due to malformed json syntax."
But I need the multi-line item to appear in Lexoffice on the invoice.
Is there a workaround for it?
I expect the long multiline text to appear on the invoice where I try to paste it with the http module
My Lexoffice-API HTTP code for URL https://api.lexware.io/v1/quotations, POST:
{
"voucherDate": "{{formatDate(now; "YYYY-MM-DDTHH:mm:ss.SSSZ")}}",
"expirationDate": "{{formatDate(addDays(now; 14); "YYYY-MM-DDTHH:mm:ss.SSSZ")}}",
"address":
{
"contactId": "{{48.data.content[].id}}"
},
"lineItems": {{108.LineItems}},
"totalPrice": { "currency": "EUR" },
"taxConditions": { "taxType": "net" },
"shippingConditions": {
"shippingType": "service",
"shippingDate": "{{formatDate(now; "YYYY-MM-DDTHH:mm:ss.SSSZ")}}"
}
}
LineItems are being set as variable {"type":"material", "id":"{{69.data.id}}", "name":"{{69.data.title}}", "description":"{{69.data.description}}"}. After that I do {{map(66.array; "LineItems")}} and after that "108.LineItems" = [{{join(104.LineItems_v0; ", ")}}]. Error is due to description length as if I delete/shorten it (to single line), all works.
1 Answer 1
The correct way to escape newlines in JSON is to replace them with the string \n
Example below is using \n\n for double lines (this is like pressing Enter key two times):
"Video Transmission & internal Recording\n\nNo Filters\n\n1x 11 Handheld Monitor 1x 19 Monitor"