str_to_object()
json_to_object()
I have a CSV file and am using "Map CSV to XDM schema" in the UI. After uploading the file with | as the delimiter, I used the function json_to_object(commerce.order._myNameSpace.customerDetails).firstName in the "calculated field" during mapping. I then mapped it to the corresponding string field in the schema.
However, the json_to_object function always failed and returned null in the dataset.
Next, I tried using the str_to_object function after modifying the string format in the CSV. I used str_to_object(commerce.order._myNameSpace.customerDetails,":",",").get("firstName") but it still didn't work and also returned null.
Any ideas why the functions never worked???? Thanks.
The functions doc:
_id|commerce.order._myNameSpace.customerDetails|commerce.order._myNameSpace.acc_order_id|commerce.order._myNameSpace.orderInvoiced_retRef|commerce.order.cancelDate|commerce.order.createdDate|commerce.order.refundTotal|commerce.order.taxAmount|eventType|personalEmail.address|producedBy|timestamp|_myNameSpace.customConfiguration
123456789|{"firstName":"Myfirstname","lastName":"MyLastName"}|123456778|Ref666|2018-11-12T20:20:39+00:00|2018-11-12T20:20:39+00:00|3812.2|29669.24|uploaded.manualy|MyFirstName.MyLastName@gmail.com|self|2025-07-24T20:22:40+00:00|{"firstName":"MyFirstName","lastName":"MyLastName"}
조회 수
답글
좋아요 수
Hi @SalamDa ,
I have observed that "order" is a keyword in AEP, so that might cause a trouble here. Can you rename the columns in your file for e.g.- rename "commerce.order._myNameSpace.customerDetails" to "customerDetails" and then try running json_to_object.
Let me know how if that works!
조회 수
답글
좋아요 수
I've never needed to use any sort of json to object mapping functions when ingesting JSON formatted data into AEP. Instead I've been able to map individual source JSON fields to my destination schema fields, and also to map source JSON objects to my destination schema objects (when the structure is identical between the two).
I would suggest trying your ingestion without that "json_to_object" function.
조회 수
답글
좋아요 수
Ah, I might have missed something in my reply.
For delimited source files, you should not have any special characters in the header line. No dots, no spaces, no hyphens, ... nothing except alphanumeric and underscores. Plus that first character in the column name can't be an underscore, must be alphanumeric only.
조회 수
답글
좋아요 수
Hi @SalamDa
Just tested it with your CSV data and it looks good.
In my UI, there's always a ${} for the variables, e.g.
I saw other cases that you may also need to put a "\" before all the "." in the variables.
Thanks,
John
조회 수
답글
좋아요 수