Mapping within Data Prep Tool for productListItems.quantity not working as expected
Hi all,
I've run into issues with mapping inside the data prep tool, specifically within productListItems. The solution would need to be able to iterate through an array.
I am experiencing a dataset error where the Quantity is coming back as a string and not a number. I updated the code in my launch script so it would stop happening but am still getting this error about once a day. I tried using the following code within Data Prep Tool using a calculated field but it is still not working. My target field would productListItems[*].quantity but I cannot use that notation inside a calculated field because it does not accept [*].
Mapping Tried
- to_integer(quantity).
- to_integer(productListItems.quantity)
Error message in datasets: #/productListItems/0/quantity: expected type: Number, found: String.
Sample Array:
[
{
"sku": "HGYU_89",
"name": "Wireless Mouse",
"pricetotal": 29.99,
"quantity": 2
},
{
"sku": "ABC_01",
"name": "Mechanical Keyboard",
"pricetotal": 89.95,
"quantity": 1
},
{
"sku": "XYZ_02",
"name": "USB-C Hub",
"pricetotal": 45.50,
"quantity": 3
}
]
Any assistance would be greatly appreciated!