<?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>How to read and write data to and from a JSON document?</title><link>https://community.appian.com/discussions/f/general/18962/how-to-read-and-write-data-to-and-from-a-json-document</link><description>Here is the scenario. The user has the ability to filter data on a report (multiple selection dropdowns) and they want to be able to save such filters so when they come back they see the same data again. I have a cdt where I save the filters so each cdt</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to read and write data to and from a JSON document?</title><link>https://community.appian.com/thread/74480?ContentTypeID=1</link><pubDate>Mon, 01 Jun 2020 18:51:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c56db29b-6a72-4806-82be-774992c6976f</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Awesome! Let me know if you have any issues, but hopefully it will be straightforward to convert back and forth to JSON when saving to the database &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;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read and write data to and from a JSON document?</title><link>https://community.appian.com/thread/74479?ContentTypeID=1</link><pubDate>Mon, 01 Jun 2020 18:45:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:45677798-20e7-4b2b-895e-7cda9a41c885</guid><dc:creator>Jose H.</dc:creator><description>&lt;p&gt;Peter, Storing the cdt filter as a json string in the table is best approach here. Converting between the 2 isn&amp;#39;t difficult.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to read and write data to and from a JSON document?</title><link>https://community.appian.com/thread/74478?ContentTypeID=1</link><pubDate>Mon, 01 Jun 2020 18:41:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e45dee83-2c7a-4a7c-9f15-d4669a57786f</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;You will definitely need a database table to store the saved filter - that&amp;#39;s the only way you can save the information for when you come back to it later. You might have seen the recipe &lt;a href="https://docs.appian.com/suite/help/latest/recipe-save-a-users-report-filters-to-data-store-entity.html"&gt;here&lt;/a&gt;&amp;nbsp;for saving filters to a database table. However, you&amp;#39;re also right that it&amp;#39;s more complex when saving multiple values. One thing I have done before is to convert the list of values into some kind of list that can be stored in a single field; for example, you could convert the list of values into a semicolon-separated text value when saving to the database. Then, when you retrieve the data back from the database, split the data back into a list using the semicolon separator.&lt;/p&gt;
&lt;p&gt;Your idea for using JSON can also work - you could store the JSON string directly as a field in your database table, and then convert the data back to a list in Appian. There is an app in the app market for the &lt;a href="/b/appmarket/posts/saved-filters-application"&gt;Saved Filters Application&lt;/a&gt;&amp;nbsp;that does something similar to this.&lt;/p&gt;
&lt;p&gt;In general, I&amp;#39;d suggest one of the two options above that use a database table rather than writing to a document directly, because the document will be much more difficult to parse and the database will perform better.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>