I am trying to manipulate my payload for a bulk API message body where I am updating multiple images at the same time. For example here I have two images:
[
{
"entry": {
"media_type": "image",
"position": [
"1",
"2"
],
"disabled": false,
"types": {
"image",
"small_image",
"thumbnail"
},
"content": {
"base64_encoded_data": [
"/9j/4ReLRXhpZgAATU0AKgAAAAgA....",
"/9j/4ReLRXhpZgAATU0AKgAAAAgA...."],
"type": "image/jpeg",
"name": [
"228186_1.jpg",
"228187_2.jpg"
]
},
"sku": [
"228186",
"228187"
]
}
}
]
but I need these to appear as two separate entries below each other... how can split this into into individual entries so that for position and sku etc it only shows one entry? eventually i will want to use this to list data for several images below each other to update the via bulk API.
This is my desired output
[
{
"entry": {
"media_type": "image",
"disabled": false,
"position": 1,
"types": [
"image",
"small_image",
"thumbnail"
],
"content": {
"base64EncodedData": ["/9j/4ReLRXhpZgAATU0AKgAAAAgA....],
"type": "image/png",
"name": "228186_1.jpg"
}
},
"sku": "228186"
},
{
"entry": {
"media_type": "image",
"disabled": false,
"position": 2,
"types": [
"image",
"small_image",
"thumbnail"
],
"content": {
"base64EncodedData": ["/9j/4ReLRXhpZgAATU0AKgAAAAgA....],
"type": "image/jpeg,
"name": "228187_2.jpg"
}
},
"sku": "228187"
}
]
Thanks!