In which order are children resopurces displayed in a JSON response?

New Member
1 0 0

Say that I either POST/PUT a resource such as a product with multiple child variants, or a customer with multiple child addresses.

 

My question is, since I do want to map the children in the JSON response with the data I initially sent to make updates in my Database, can I assume the the children in the response will always be in the very same order of what I sent to the API?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
296 32 59

Hey there,

 

These resources will be sorted by their ID in ascending order.

 

Therefore, you shouldn't rely on the order in which you made the call when mapping the objects, but instead on their ID.

0 Likes