Rename keys in an array

I have an array of items created with the Array Aggregator function:
[
{
“array”: [
{
“2”: “dom1301”,
“3”: “dom1301 30 years coaster”,
“6”: “1”
},
{
“2”: “dom1309”,
“3”: “dom1309 Bon Jovi”,
“6”: “1”
}
],
IMTAGGLENGTH”: 2
}
]

I would like to rename the keys from “2”,“3”,“6” to “sku”,“name”,“quantity” so I can create an order in ShipStation using an array of items. It’s expecting specific keys.

Any thoughts on how to do that?

Thanks in advance!

Hi @Kim_Lloyd,

Are you directly using it through aggregator target/destination data structure option and then using the array in Shipstation mapping?

2 Likes

Yes, that is the goal. But the keys in the array that Shipstation expects, do not match what the aggregator data structure is. I don’t see a way of “overriding” the target structure key names. I am:
Updating a Google sheet with line items for an order: SKU, item, quantity
Using the Google sheet module search for rows to get all the line items for a specific order
Using the Array Aggregator module to map the items into an array (see the resultant structure below)

2  24. sku (C)
3. 24. name (D)
6. 24. quantity (G)

ShipStation requires that when you update an order you update all the information in the entire order each time, you can’t just add individual items.

I can use the iterator to go through all of the rows if I need to and put them into a new complex array, but I’m not sure how to do that.

Alright thanks Runcorn, your question helped me dig a little deeper and figured out I could map the Array Aggregator to the Order items structure. I didn’t see that option earlier! Thank you.

1 Like

Hello @Kim_Lloyd welcome to the community :wave:

It’s great to hear that @Runcorn 's guidance helped you figure out how to make things work for you! Thanks a lot for stepping back in here and keeping us posted about your progress :pray:

Just FYI: I’ve marked your last comment as the solution. This way, anyone browsing the community will know where to direct their attention.