<?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>Write JSON to document</title><link>https://community.appian.com/discussions/f/integrations/30776/write-json-to-document</link><description>Hello, 
 i have a Web Service and i save the Result.body response as in a process variable map. 
 For auditing reasons i need to save this result as a *.json file that just needs to stay in the Knowledge Center for now. 
 How can i achieve this? 
 I have</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Write JSON to document</title><link>https://community.appian.com/thread/122549?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2023 08:21:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3ce4efc5-2c2b-4a3c-bb8a-bb108979266b</guid><dc:creator>Chiara Gambone</dc:creator><description>&lt;p&gt;Well you are right, it was&amp;nbsp;a&amp;nbsp;misjudgment&amp;nbsp;on my part thinking the map would be written out as i saw it in the process variable.&lt;/p&gt;
&lt;p&gt;Thank you all&lt;/p&gt;
&lt;div style="display:none;position:absolute;"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write JSON to document</title><link>https://community.appian.com/thread/122517?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 17:43:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:db008ce5-36b4-4e1f-b8b5-f4d20fba09f1</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;yeah, if you pass a MAP directly into the &amp;quot;body&amp;quot; replacement, i&amp;#39;m not sure why you&amp;#39;d expect it to output as JSON - a MAP is not JSON.&amp;nbsp; As Abhay suggested, you can wrap the map value in a!toJson and get a proper JSON string for output into your document.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write JSON to document</title><link>https://community.appian.com/thread/122510?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 17:17:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e14db28a-bf43-4435-b09f-639b831b42d4</guid><dc:creator>Abhay Dalsaniya</dc:creator><description>&lt;p&gt;try tojson(pv!bodyMap) for BODY parameter.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write JSON to document</title><link>https://community.appian.com/thread/122508?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 17:13:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d6f9a895-334d-4335-8bb5-94b6a94ffbc4</guid><dc:creator>Chiara Gambone</dc:creator><description>&lt;p&gt;Thank you &amp;nbsp;and &lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;&amp;nbsp;. I mentioned I had altready tried using &amp;quot;Text Doc from Template&amp;quot; but maybe I wasn&amp;#39;t clear, let me show you what I&amp;#39;ve tried to do:&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/18/pastedimage1701363864556v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve configured a Test Process Model where I save the web service response as a Map and as a Text:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/18/pastedimage1701364249118v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;then try to write both in the above template:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/18/pastedimage1701364398941v5.png" alt=" " /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/18/pastedimage1701364411730v6.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;These are the two resulting files, they are not valid json:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/18/pastedimage1701364359791v4.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Am I missing something?&lt;/p&gt;
&lt;p&gt;Thank you for your time&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div style="display:none;position:absolute;"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write JSON to document</title><link>https://community.appian.com/thread/122475?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 13:13:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:006d059b-318d-4c6c-b0a1-874973891efb</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="59361" url="~/discussions/f/integrations/30776/write-json-to-document/122474"]&amp;quot;Test from Template&amp;quot;[/quote]
&lt;p&gt;For the sake of confusion reduction, that is of course the &amp;quot;Text Doc from Template&amp;quot; node.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/18/pastedimage1701350015046v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Sadly there isn&amp;#39;t (yet?) a rule-based approach (like we have with, say, &lt;em&gt;a!exportDataStoreEntityToExcel()&lt;/em&gt;), but the process-based node works well enough at least.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write JSON to document</title><link>https://community.appian.com/thread/122474?ContentTypeID=1</link><pubDate>Thu, 30 Nov 2023 11:46:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:14b398f1-f006-4ffb-9c25-048b697ca328</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;The smart service &amp;quot;Test from Template&amp;quot; can write any text to a file. Create a template.json file with the content &amp;quot;###json###&amp;quot; and write to it whatever you need.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>