How to stop AppInsights flattening array of strings from a simple http post

  azure-application-insights, c++, json

I am trying to send data to AppInsights from cpp as a simple piece of json. But, AppInsights insists of flattening my array of strings into a comma separated string.

For example, if the post body is this:

{
    "data": {
        "baseData": {
            "name": "UWMLicensing",
            "properties": {
                "myValues": ["1", "2"]
            },
            "ver": "2"
        },
        "baseType": "EventData"
    },
    "iKey": "<iKey>",
    "name": "Event",
    "time": "2021-09-15T17:00:16Z"
}

This arrives in AppInsights as a customEvent with the customDimensions set to the myValues property. However, the customDimensions data is set to:

{"myValues": "1, 2"}

I’d like AppInsights to leave the array alone and for the customDimensions be set to:

{"myValues": ["1", "2"]}

How can I convince AppInsights to not flatten my array and leave the data as it was?

Source: Windows Questions C++

LEAVE A COMMENT