<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Update value in the nested json</title><link>https://community.appian.com/discussions/f/rules/26042/update-value-in-the-nested-json</link><description>I have a nested json. I need to update its field &amp;quot;responestext&amp;quot; if its questiontitle is equal to the parameter. Then return the new json. But the original variable metadataJSON is not updated. Is there any function to update the origin value?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101953?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 12:20:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3362d150-0f2c-4154-88a2-8e7fd5cfbf7a</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Appian uses a functional approach. And there is no functional language which allows you to do that. Check out the docs:&amp;nbsp;&lt;a href="https://docs.appian.com/suite/help/22.3/Expressions.html#functions-and-side-effects"&gt;https://docs.appian.com/suite/help/22.3/Expressions.html#functions-and-side-effects&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101950?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 12:16:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:755981d3-6249-4612-95c6-e5f61bc57dcd</guid><dc:creator>kevins1191</dc:creator><description>&lt;p&gt;Got it. Thanks! It is great help. But I still cannot understand why I cannot do the update in the forEach directly. Because it is common in other language to update something in the forEach&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101948?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 12:09:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:64984e9e-e527-4db7-82a4-188b5ce5e94e</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Sure. You create the modified copy in local!result but then define the unmodified value as the output.&lt;/p&gt;
&lt;p&gt;In case you need a JSON string as the output, call toJson() to do so.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101947?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 12:05:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bf642f71-cd30-4b2f-879b-10483e97c024</guid><dc:creator>kevins1191</dc:creator><description>&lt;p&gt;Thanks for your suggestion. But How can I do it? Currently I do it in the expression rule. The json, targetField and value are the parameter. I parse the json as a new object in the rule and I do the change on this new object.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101941?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 11:12:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:287df67f-c132-4f33-96c1-7226c2760c35</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;You cannot &amp;quot;change&amp;quot; a value in an expression in Appian. instead, you create a modified copy as the returned value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101939?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 11:00:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d2894f40-dddb-46d6-95e7-3261bac4d9b9</guid><dc:creator>kevins1191</dc:creator><description>&lt;p&gt;&lt;span&gt;targetField&amp;nbsp;is &amp;quot;CV Upload&amp;quot;.Value is a string. You can set it anything&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101933?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 10:10:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:01828c6d-4f53-4109-b748-3d7590fe9131</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;What are the values of&amp;nbsp;targetField and&amp;nbsp;value Rule Inputs?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101932?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 09:56:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f3fdcd27-73bd-44d5-b15b-fafc8ddb32e1</guid><dc:creator>kevins1191</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="json"&gt;[
    {
        &amp;quot;customkey&amp;quot;: &amp;quot;&amp;quot;,
        &amp;quot;sectioninstructions&amp;quot;: &amp;quot;&amp;quot;,
        &amp;quot;sectionparent&amp;quot;: &amp;quot;root&amp;quot;,
        &amp;quot;questions&amp;quot;: [
            {
                &amp;quot;customkey&amp;quot;: &amp;quot;&amp;quot;,
                &amp;quot;rowlabelstyle&amp;quot;: &amp;quot;&amp;quot;,
                &amp;quot;rowlabel&amp;quot;: &amp;quot;CV Submission&amp;quot;,
                &amp;quot;questionrow&amp;quot;: [
                    {
                        &amp;quot;customkey&amp;quot;: &amp;quot;&amp;quot;,
                        &amp;quot;ismandatory&amp;quot;: &amp;quot;&amp;quot;,
                        &amp;quot;questiontooltip&amp;quot;: &amp;quot;&amp;quot;,
                        &amp;quot;questionid&amp;quot;: 1,
                        &amp;quot;readonly&amp;quot;: &amp;quot;&amp;quot;,
                        &amp;quot;questioninstructions&amp;quot;: &amp;quot;&amp;quot;,
                        &amp;quot;questiontitle&amp;quot;: &amp;quot;CV Upload&amp;quot;,
                        &amp;quot;responsetype&amp;quot;: &amp;quot;recordaction&amp;quot;,
                        &amp;quot;responsevalue&amp;quot;: &amp;quot;&amp;quot;,
                        &amp;quot;responsetext&amp;quot;: &amp;quot;&amp;quot;,
                        &amp;quot;parentid&amp;quot;: 1
                    }
                ]
            }
        ],
        &amp;quot;sectionlevel&amp;quot;: 1,
        &amp;quot;nestedjson&amp;quot;: &amp;quot;&amp;quot;,
        &amp;quot;sectionstyle&amp;quot;: &amp;quot;bold&amp;quot;,
        &amp;quot;sectiontype&amp;quot;: &amp;quot;card&amp;quot;,
        &amp;quot;collapsible&amp;quot;: true,
        &amp;quot;sectionname&amp;quot;: &amp;quot;Questionnaire&amp;quot;,
        &amp;quot;objectid&amp;quot;: 1,
        &amp;quot;parentid&amp;quot;: 0
    }
]
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is the json. I need to update the &amp;quot;responsevalue&amp;quot; for the item in the &amp;quot;questionrow&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101930?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 09:50:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e9989e6b-e0de-4122-8efb-3223c4bea554</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Can you paste the JSON here as code for better debugging?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101928?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 09:21:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:72491a28-9244-4c1c-b1a2-490ca5260cb7</guid><dc:creator>kevins1191</dc:creator><description>&lt;p&gt;In result variable&lt;span&gt;&amp;nbsp;it misses some fields. And the data struct is different.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The origin json&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;img src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/15/pastedimage1664270509704v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The result variable&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/15/pastedimage1664270543753v2.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update value in the nested json</title><link>https://community.appian.com/thread/101926?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2022 09:18:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b3f742a8-b1f2-4f01-8825-b8093f3c3e9d</guid><dc:creator>Durgesh Kahar</dc:creator><description>&lt;p&gt;Check your result variable value.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>