Skip to main content

HTML to PDF json malformed error

Updated over 4 months ago

HTML to PDF json malformed error

When you have double-quotes (") in your raw HTML code, it could break the input JSON request. There are two ways to fix this issue:

  1. Add a escape character before the double-quotes or \".

{
  "html": "<img src=\"https://url\" />"
}
  1. Replace double quotes with a single quote or ' instead of ".

{
  "html": "<img src='https://url' />"
}

If you have double-quotes inside double-quotes, we recommend using &quot;.

Incorrect

{
  "html": "This is a "Test"."
}

Correct

{
  "html": "This is a &quot;Test&quot;."
}
Did this answer your question?