JSON Object - Delete from
Declaration
<AMJSON ACTIVITY="delete_from" JSONOBJECT="text" PATH="text" DELETEBY="text (options)" INDEX="number" />
Description
Deletes one or all values from an existing array inside a Automate Desktop JSON Object.
Practical usage
JSON is primarily used to transmit data between a server and web application, as an alternative to XML. Use this activity to delete one or all values from an existing array inside an Automate Desktop JSON Object.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
JSON Object name | Text | Yes | (Empty) | JSONOBJECT="donuts" | The name of the JSON Object containing the array to delete from. |
Array to delete from | Text | Yes | (Empty) | PATH="type" | The name of the array to delete one or all values from. To select an array, click Select array, and then from the dialog that appears, choose the desired array by clicking its hyperlink. |
What to delete | Text (options) | Yes | By index |
|
Specifies which value(s) to delete from the array. The available options are:
|
Index to delete | Text | Yes | (Empty) | INDEX="3" | Specifies the index number of the value to delete from the array. This parameter becomes available and is required when What to delete is set to By index. |
Example
NOTE:
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
This sample task deletes a value by its index number from an array inside an Automate Desktop JSON Object.
Copy
<AMJSON JSONOBJECT="donuts" JSONSTRING="{
 "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" }
 ]
}" />
<AMJSON ACTIVITY="delete_from" JSONOBJECT="donuts" PATH="batters.batter" DELETEBY="index" INDEX="1" />