Overview
This article addresses an issue where certain fields, such as user.identities
, are blank in the Comma Separated Values (CSV) output file from a bulk user export, despite the data existing in the user profile. This guide explains the cause and provides the correct method to export array data.
Applies To
- Bulk User Export
- CSV
- JSON
Cause
The identities
field is an array of objects. When exporting to a CSV file, this complex data structure does not automatically flatten into the simple column format required by CSV, which results in the field appearing blank in the output file.
Solution
To correctly export array data to a CSV file, specify each element of the array using both array indexing and dot notation in the fields
parameter of the export request. The export_as
parameter defines the column header in the output file.
{
"connection_id": "<CONNECTION_ID>",
"format": "csv",
"fields": [
{ "name": "email" },
{ "name": "identities[0].provider", "export_as": "provider" },
{ "name": "identities[0].user_id", "export_as": "user_id" },
{ "name": "identities[0].connection", "export_as": "connection" }
]
}
- Alternatively, export the data in JSON format, which supports exporting the entire
identities
array directly. The resulting JSON file can then be converted to a CSV file.