Invalid CSV Escaping & PHP Serialization in form 'Form Fill' Activities in Bulk Activity Export
⚠️
This post has been edited by a moderator for accuracy.
When exporting Marketo Activity, specifically Form Fill activities, we have encountered two issues that cause problems when trying to reliably parse the exported CSV file.
1. 'checksumFields' Value Contains Unescaped Commas
Inside the attributes field, there is a Form Fields entry. This contains a checksumFields value which is a comma-separated list of field names. However, this is not properly escaped for CSV (RFC 4180). As a result:
-
Commas are interpreted as field delimiters. -
CSV parsers break and produce misaligned columns. -
Downstream systems cannot reliably import these exports.
Example:
"checksumFields":"FirstName,LastName,Title,Company,Email"
Because of this, CSV readers see FirstName, LastName, etc., as separate fields.
2. 'Form Fields' is PHP Serialized, Not JSON
Unlike the rest of the attributes object (which uses JSON-like syntax), the Form Fields value is PHP serialized.
Example snippet:
""Form Fields"":""a:11:{s:6:\"module\";s:11:\"leadCapture\";s:6:\"action\";s:5:\"save2\";s:9:\"FirstName\";s:4:\"John\";s:8:\"LastName\";s:5:\"Doe\";s:5:\"Title\";s:7:\"Manager\";s:7:\"Company\";s:9:\"ExampleCo\";s:5:\"Email\";s:24:\"john.doe@example.com\";s:6:\"formid\";s:4:\"1628\";s:10:\"munchkinId\";s:11:\"000-XXX-000\";s:8:\"_mkt_trk\";s:53:\"id:000-XXX-000&token:_mch-example.com-1719224514646-57494\";s:7:\"formVid\";s:4:\"1628\";s:13:\"_mktoReferrer\";s:58:\"https://www.example.com/en/events/example-event\";s:14:\"checksumFields\";s:69:\"FirstName,LastName,Title,Company,Email,formid,munchkinId,_mkt_trk,formVid,_mktoReferrer\";s:8:\"checksum\";s:64:\"abc123def456ghi789jkl012mno345pqr678stu901vwx234yz567abc890def\";}""
Problems with this approach:
-
PHP serialization is not universally readable outside PHP.
-
Serialization outputs : and ; characters which don't interact well with CSV exports.
-
It introduces complexity for developers working in other languages.
-
It’s inconsistent with the surrounding JSON-style attributes.
Impact on Standard CSV Parsing
The current CSV export is not RFC 4180 compliant due to the unescaped commas within the 'checksumFields' data. This causes failures with any standard CSV parsing tools, which interpret these commas as new columns. We are saving the export exactly as provided by Marketo via the Bulk Activity Extract API — the issue exists in the raw export data.
To work around this, we have switched to using TSV exports for Activity Extracts, which avoid this issue because tabs do not appear within the serialized data.Ideally, Marketo should ensure CSV exports follow the RFC 4180 standard by escaping commas correctly. Additionally, using JSON encoding for 'Form Fields' would bring consistency and improve interoperability.
I’m sharing this in the hopes it helps others encountering the same issues when working with these exports.