JSON Object - Set values

Declaration

<AMJSON ACTIVITY="set_values" JSONOBJECT="text"><NEWVALUE ISNULL="True/False" PATH="text" VALUE="text" /></AMJSON>

Related Topics    

Description

Sets specific field values inside an already or newly defined 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 set a value inside an already defined or newly defined 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 to set the value in.
Field Text Yes (Empty)
  • PATH=""
  • PATH="id"
  • PATH="batters.batter[2].type"
The name of the field to set within the JSON Object. The path can set a field in the root, in an object, or in an array. To set a value, click Set values, and then from the dialog that appears, enter the value in the desired box. When finished, click OK.
Value Text Yes (Empty) VALUE="Berry" The value to set within the field in the JSON Object.
Null True/False No False
  • ISNULL="True"
  • ISNULL="False"
If selected (True), the value is set to Null. This parameter is cleared (False) by default.

Description

Error Causes

On Error

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 sets the Blueberry value in the batters.batter array to Berry within an Automate Desktop JSON Object.

Copy
<AMJSON JSONOBJECT="donuts" JSONSTRING="{&#xD;&#xA;    &quot;id&quot;: &quot;0001&quot;,&#xD;&#xA;    &quot;type&quot;: &quot;donut&quot;,&#xD;&#xA;    &quot;name&quot;: &quot;Cake&quot;,&#xD;&#xA;    &quot;ppu&quot;: 0.55,&#xD;&#xA;    &quot;batters&quot;:&#xD;&#xA;        {&#xD;&#xA;            &quot;batter&quot;:&#xD;&#xA;                [&#xD;&#xA;                    { &quot;id&quot;: &quot;1001&quot;, &quot;type&quot;: &quot;Regular&quot; },&#xD;&#xA;                    { &quot;id&quot;: &quot;1002&quot;, &quot;type&quot;: &quot;Chocolate&quot; },&#xD;&#xA;                    { &quot;id&quot;: &quot;1003&quot;, &quot;type&quot;: &quot;Blueberry&quot; },&#xD;&#xA;                    { &quot;id&quot;: &quot;1004&quot;, &quot;type&quot;: &quot;Devil's Food&quot; }&#xD;&#xA;                ]&#xD;&#xA;        },&#xD;&#xA;    &quot;topping&quot;:&#xD;&#xA;        [&#xD;&#xA;            { &quot;id&quot;: &quot;5001&quot;, &quot;type&quot;: &quot;None&quot; },&#xD;&#xA;            { &quot;id&quot;: &quot;5002&quot;, &quot;type&quot;: &quot;Glazed&quot; },&#xD;&#xA;            { &quot;id&quot;: &quot;5005&quot;, &quot;type&quot;: &quot;Sugar&quot; },&#xD;&#xA;            { &quot;id&quot;: &quot;5007&quot;, &quot;type&quot;: &quot;Powdered Sugar&quot; },&#xD;&#xA;            { &quot;id&quot;: &quot;5006&quot;, &quot;type&quot;: &quot;Chocolate with Sprinkles&quot; },&#xD;&#xA;            { &quot;id&quot;: &quot;5003&quot;, &quot;type&quot;: &quot;Chocolate&quot; },&#xD;&#xA;            { &quot;id&quot;: &quot;5004&quot;, &quot;type&quot;: &quot;Maple&quot; }&#xD;&#xA;        ]&#xD;&#xA;}" />
<AMJSON ACTIVITY="set_values" JSONOBJECT="donuts"><NEWVALUE ISNULL="False" PATH="batters.batter[2].type" VALUE="Berry" /></AMJSON>