Remove JSON Array Object and properties within it
I have an JSON array and I would like to remove one of the objects. The path of the array is attachments[1]. Using the update json action with the remove path operation doesn't work.
I can remove the individual properties within the array object using the remove path operation but when I do this the empty curly braces {} still remain for the object.
Is there a way to remove an array object entirely?

{
"attachments": [
{
"type": "%AttachmentTypeOther%",
"name": "%AttachmentNameOther%",
"content": "%AttachmentContentOther%"
},
{
"type": "%AttachmentTypeBOL%",
"name": "%AttachmentNameBOL%",
"content": "%AttachmentContentBOL%"
}
]}
- Iisedwinr @isedwinr
Hi,
It's not the cleanest of solutions but RegEx Replace or Search and Replace for the last part maybe is an option?
I don't know much about Json so maybe this is not suitable at allEdwin
- DIn reply tomatty⬆:Daniel Horton @daniel.horton
Hi Matty,
We have found the issue and resolved this in our next pre-release.
For clarity when you use the Remove Path functionality and supply an array index position it automatically updates the array index. This means that if you wish to remove items 2 and 3 you would need to call position 1 twice in your Remove Path.
With the following example if we wished to remove topping[1] and topping [2] we would do it like this:
{ "id": "0001", "type": "donut", "name": "Cake", "ppu": 0.55, "batters": { "batter": [ { "id": "1001", "type": "Regular" }, { "id": "1002", "type": "Chocolate" }, { "id": "1003", "type": "Blueberry" }, { "id": "1004", "type": "Devil's Food" } ] }, "topping": [ { "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5005", "type": "Sugar" }, { "id": "5007", "type": "Powdered Sugar" }, { "id": "5006", "type": "Chocolate with Sprinkles" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] }