Custom Context data attribute sent as a string not an array


#1

When sending Structured Events some on some pages I see the data array being wrapped in a double quotes resulting in enrichment failure. Does anyone know what could cause something like this (bellow is a co parameter send with the hit):
co:
{“schema”:“iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0”,“data”:"[{\“schema\”: \“iglu:com.google.analytics/cookies/jsonschema/1-0-0\”, \“data\”: {\"__utma\": \“43228856.142546572.1512160550.1512478459.1512478459.1\”, \"__utmz\": \“43228856.1512478459.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\”, \"_ga\": \“GA1.2.142546572.1512160550\”}}, {\“schema\”: \“iglu:com.tgam/scroll/jsonschema/1-0-0\”, \“data\”: {\“percent\”: 75, \“top\”: 601, \“bottom\”: 1513, \“timeSinceLoad\”: 42402, \“timeSinceLast\”: 38581}}]"}
The issue is with having main contexts “data” array being sent as a string.


#2

This was caused by prototype.js overriding default JSON.stringify function for arrays. I solved by following advice outlined here https://stackoverflow.com/questions/710586/json-stringify-array-bizarreness-with-prototype-js


#3

Thanks for sharing @mbondarenko!