REST: Error parsing xhtml: Unexpected character '\\'

Hello,

I’ve been working on creating a page in Confluence from a template with REST. I’ll been using the approach from this thread

When I pass in a format that contains only text, the code works and creates the page correctly. However, when I pass in a format with a macro, I get a response like this:

"message": "com.atlassian.confluence.api.service.exceptions.BadRequestException: Error parsing xhtml: Unexpected character '\\' (code 92) in start tag Expected a quote\n at [row,col {unknown-source}]: [1,509]"

_bump