We are using Marketo API to create leads in bulk. We got a situation where we are not able store a string with double quotes in it.
Example: FullName = David "Graham"
In above example "Graham" is in double quotes. So, Marketo API throws invalid JSON format error. Could you please help me in handling this issue?
JSON escaped quotes is an industry-standard format (an RFC, in fact) and will work fine against the REST Leads endpoint, no need for any webhook workaround!
Please provide the full JSON of your request as it goes on the wire to Marketo. If you use Postman you'll see a properly-formatted JSON payload works fine.
Thanks, Sanford. I have figured out the root cause. We were actually storing JSON format in a C# string before passing in API which was converting \" as ". We did correct it now so that \" will be passed to API instead double quotes(").
Thanks again for the detailed explanation which was helpful.
Webhook to php file with XML responses
Replace " with some other character like |. Have a smart campaign listening on data value change and new value contains | > call webhook
* Note to set XML webhook response type to XML
You're php code would be:
$fn = $_POST['fn'];
$ln = $_POST['ln'];
$fn = preg_replace('/\|/', '"', $fn);
$ln = preg_replace('/\|/', '"', $ln);
echo "<?xml version='1.0' encoding='UTF-8'?>";