<?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>[Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/discussions/f/rules/20895/bug-fromjson-not-converting-empty-strings-to-null-as-described</link><description>We had an issue at production yesterday where the system tried to access a property inside an empty string. Looking more closely, we discovered that the a!fromJson is not doing as it was supposed to do. 
 Here on the a!fromJson (21.1) documentation, we</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/thread/81406?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 15:32:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:894fff41-f37b-4183-8109-05c3cd99aeb9</guid><dc:creator>Arthur Lyrio</dc:creator><description>&lt;p&gt;Great solution, I prefer using split to a Text path instead of using an array.&lt;br /&gt;&lt;br /&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/15/pastedimage1620228731704v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/thread/81405?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 15:23:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f9319f58-7768-4930-a0f5-beb1cc29f696</guid><dc:creator>Arthur Lyrio</dc:creator><description>&lt;p&gt;Yes, it&amp;#39;s a nice approach.&lt;br /&gt;&lt;br /&gt;We usually just learn the &lt;strong&gt;index&lt;/strong&gt; function first and as the &lt;strong&gt;property&lt;/strong&gt; does a part of the same job the index does we usually forget about it and use index for everything.&lt;br /&gt;&lt;br /&gt;But for readability, it is much better as it speaks out what it is doing there on the code, getting a property.&lt;br /&gt;&lt;br /&gt;In fact, seems that &lt;strong&gt;index&lt;/strong&gt; is the one that does more stuff &amp;quot;than it should do&amp;quot; looking only by its name.&lt;br /&gt;Even if some languages have named indexes already, don&amp;#39;t know maybe I am being a little old school here hahahahah&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But, thanks for the tip &lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/thread/81400?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 14:17:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7f1ef40e-b9b7-4dfe-a56e-81c86d0e30d6</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;On my normal soapbox: &lt;em&gt;index()&lt;/em&gt; and &lt;em&gt;property()&lt;/em&gt; have allegedly identical functionality, but as usual i must insist that you consider using them for their namesake purposes.&amp;nbsp; That is to say, if you&amp;#39;re getting an index (i.e. a position in an array), use &lt;em&gt;index()&lt;/em&gt;.&amp;nbsp; If you&amp;#39;re getting a property (i.e. a dot property member of a CDT or dictionary), use &lt;em&gt;property()&lt;/em&gt;.&amp;nbsp; When code gets more complex this dramatically increases readability later on.&amp;nbsp; There are zero reasons not to do this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/thread/81388?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 09:44:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a6c5456f-a202-4919-9269-a7094e75d7ea</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Do this&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  isnull(ri!path),
  ri!data,
  reduce(
    index(_,_,ri!default),
    ri!data,
    ri!path
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/15/pastedimage1620207892558v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;Where path is a list of a mix of field names and indexes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/thread/81387?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 09:41:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6304177b-ef52-4079-813d-bd0b74a00996</guid><dc:creator>Arthur Lyrio</dc:creator><description>&lt;p&gt;Nice, thanks , found its documentation &lt;a href="https://docs.appian.com/suite/help/21.1/fnc_informational_error.html"&gt;here&lt;/a&gt; didn&amp;#39;t know about it &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;br /&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/thread/81385?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 09:38:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:65a694e8-5eb6-42f3-b57d-37a0dd4571f1</guid><dc:creator>Arthur Lyrio</dc:creator><description>&lt;p&gt;Yes, it&amp;#39;s safer, but is verbose as hell.&lt;br /&gt;&lt;br /&gt;Of course safety is more important, but who did this tried to access the fifth property on a chain, like this:&lt;/p&gt;
&lt;div style="background-color:#1e1e1e;color:#d4d4d4;font-family:Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div&gt;&lt;span style="color:#569cd6;"&gt;base&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;.&lt;/span&gt;&lt;span style="color:#9cdcfe;"&gt;porpertyOne&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;.&lt;/span&gt;&lt;span style="color:#9cdcfe;"&gt;propertyTwo&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;.&lt;/span&gt;&lt;span style="color:#9cdcfe;"&gt;propertyThree&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;.&lt;/span&gt;&lt;span style="color:#9cdcfe;"&gt;propertyFour&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;.&lt;/span&gt;&lt;span style="color:#9cdcfe;"&gt;propertyFive&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;We fixed with something like this:&lt;/p&gt;
&lt;div style="background-color:#1e1e1e;color:#d4d4d4;font-family:Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div style="background-color:#1e1e1e;color:#d4d4d4;font-family:Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div&gt;&lt;span style="color:#dcdcaa;"&gt;index&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;(&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#dcdcaa;"&gt;index&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;(&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#dcdcaa;"&gt;index&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;(&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#dcdcaa;"&gt;index&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;(&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#dcdcaa;"&gt;index&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;(&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#569cd6;"&gt;base&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#ce9178;"&gt;&amp;quot;propertyOne&amp;quot;&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#569cd6;"&gt;null&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;),&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#ce9178;"&gt;&amp;quot;propertyTwo&amp;quot;&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#569cd6;"&gt;null&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;),&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#ce9178;"&gt;&amp;quot;propertyThree&amp;quot;&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#569cd6;"&gt;null&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;),&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#ce9178;"&gt;&amp;quot;propertyFour&amp;quot;&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#569cd6;"&gt;null&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;),&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#ce9178;"&gt;&amp;quot;propertyFive&amp;quot;&lt;/span&gt;&lt;span style="color:#d4d4d4;"&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:#569cd6;"&gt;null&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color:#d4d4d4;"&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;But the problem here is not the amount of code to solve this, but the divergence between what was documented to its actual behavior.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Question/Suggestion&lt;/strong&gt;:&lt;br /&gt;Can&amp;#39;t Appian just ignore all of those properties ahead of the variables if the variable is not of a dictionary/CDT type as it &amp;quot;does&amp;quot; to null, for example ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/thread/81384?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 09:37:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4a145c22-c755-489f-ac23-f1ddcc95b34e</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;error() is a supported function while try() is not.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/thread/81382?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 09:11:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:07ac6063-d304-4dc0-8659-a3e7756f7f1c</guid><dc:creator>Arthur Lyrio</dc:creator><description>&lt;p&gt;&lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;&lt;br /&gt;Yeap, we fixed using the index function to get the value if it is present, thanks for the suggestion.&lt;br /&gt;&lt;br /&gt;But isn&amp;#39;t error() or even try() undocumented ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/thread/81364?ContentTypeID=1</link><pubDate>Tue, 04 May 2021 17:48:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e3791476-6866-4d33-86e2-e1090901525b</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Agreed with Mike - it&amp;#39;s always better to use a function that allows for null checking like property() or index(). Also one thing to keep in mind: &amp;quot;&amp;quot; is also considered null. For instance, if you try&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;&amp;quot;&amp;quot; = null&lt;/pre&gt; it should return true. However, the problem is that &lt;em&gt;&amp;quot;&amp;quot;&lt;/em&gt; is of type text, while&amp;nbsp;&lt;em&gt;null&lt;/em&gt; doesn&amp;#39;t have a type. A text doesn&amp;#39;t allow you to index fields out of it, while a field that is any type would allow that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Bug] fromJson not converting empty strings to null as described</title><link>https://community.appian.com/thread/81363?ContentTypeID=1</link><pubDate>Tue, 04 May 2021 17:26:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cf758f47-0142-4d15-9252-6af485fdf1a3</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;As an aside, I always recommend using the &lt;em&gt;&lt;strong&gt;property()&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;&lt;/strong&gt; function when accessing a CDT or dictionary property from an object when you&amp;#39;re not sure whether it&amp;#39;ll actually have that property.&amp;nbsp; This allows you to sidestep even needing error messages.&amp;nbsp; If you really require a system error, you could look into using &lt;em&gt;error()&lt;/em&gt; depending on whatever result you&amp;#39;re returned from the &lt;em&gt;property()&lt;/em&gt; function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>