- Newest
- Most votes
- Most comments
When you create a CSV file for upload to S3, you need to ensure that the JSON object is represented correctly as a string. To represent a JSON object in a CSV file as a string, use double quotes around the entire object.
For example, if you have the attributes firstName and lastName, the correct representation in the CSV file would be:
"AttributesData" "{\"firstName\":\"John\",\"lastName\":\"Doe\"}"
Here, the AttributesData field contains a JSON object as a string, and it is enclosed in double quotes to ensure that commas within the JSON object do not interfere with the CSV format.
For example, if you have the attributes firstName and lastName, the correct representation in the CSV file would be:
"AttributesData" : "{\"firstName\":\"John\",\"lastName\":\"Doe\"}"
Here, the AttributesData field contains a JSON object as a string, and it is enclosed in double quotes to ensure that commas within the JSON object do not interfere with the CSV format.
If you want to add multiple attributes to the AttributesData field, you can include all of them within the JSON object. For example:
"AttributesData" : "{\"firstName\":\"John\",\"lastName\":\"Doe\",\"age\":30,\"email\":\"john.doe@example.com\"}"
In this case, the AttributesData field contains multiple attributes: firstName, lastName, age, and email.
If you experienced incorrect behaviour when trying to export topicPreferences.MyTopic
, it is possible that the CSV file formatting or data mapping was problematic. In the AttributesData field, double-check your CSV file's structure and content to ensure it is correctly formatted with valid JSON objects.
Having shared the above, to answer your question and assist you in right direction, we require details that are non-public information. Please open a support case with AWS using the following link https://console.aws.amazon.com/support/home#/case/create
Relevant content
- asked 4 months ago
- asked 6 years ago
- asked 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
No, it doesn't work. I tried all these possibilities. CSV file content was:
First I made as you stated: stringified JSON object
emailAddress,unsubscribeAll,attributesData,topicPreferences.my-topic
my@e.mail,false,"{\"firstName\":\"John\",\"lastName\":\"Doe\"}",OPT_IN
-- it didn't workThen I tried stringified JSON object without commas:
emailAddress,unsubscribeAll,attributesData,topicPreferences.my-topic
my@e.mail,false,"{\"firstName\":\"John\"}",OPT_IN
-- it also didn't workThis is what I started with: valid non-stringified JSON object
emailAddress,unsubscribeAll,attributesData,topicPreferences.my-topic
my@e.mail,false,{"firstName":"John","lastName":"Doe"},OPT_IN
-- didn't work because of comma inside JSONAnd finally, but I wrote about it yesterday
emailAddress,unsubscribeAll,attributesData,topicPreferences.my-topic
my@e.mail,false,{"firstName":"John"},OPT_IN
-- the only CSV file content that worked because there's no commas and it really is valid non-stringified JSON objectany more suggestions?
P.S. as I understood, CSV parser doesn't care about escaped chars. it sees comma - it makes it the end of the "cell"