<?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>Converting dictionary to a different JSON response</title><link>https://community.appian.com/discussions/f/integrations/20801/converting-dictionary-to-a-different-json-response</link><description>Hi, 
 How can I convert the below dictionary- 
 { name:&amp;quot;Vivek&amp;quot;, place:&amp;quot;XYZ&amp;quot; } 
 
 to something like this: 
 
 
 &amp;quot;{\&amp;quot;name\&amp;quot;:\&amp;quot;Vivek\&amp;quot;,\&amp;quot;place\&amp;quot;:\&amp;quot;XYZ\&amp;quot;}&amp;quot; 
 
 It is a bit from what a!toJson function returns. Any lead will be helpful. 
 
 Thanks!</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Converting dictionary to a different JSON response</title><link>https://community.appian.com/thread/81023?ContentTypeID=1</link><pubDate>Tue, 20 Apr 2021 12:34:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1ba4e01d-44d9-4d16-9177-47e460e5b810</guid><dc:creator>baratc</dc:creator><description>&lt;p&gt;Hi Vivek&lt;/p&gt;
&lt;p&gt;Please try the below code&amp;nbsp; which is closer to your output.&lt;/p&gt;
&lt;p&gt;a!localVariables(&lt;br /&gt; local!data:{&lt;br /&gt; {name:&amp;quot;Vivek&amp;quot;,&lt;br /&gt; place:&amp;quot;XYZ&amp;quot;}&lt;br /&gt;} ,&lt;br /&gt;local!final:substitute(insertkeyval(&amp;quot;name&amp;quot;,local!data["name"],&amp;quot;\&amp;quot;,&amp;quot;\&amp;quot;),&amp;quot;=&amp;quot;,&amp;quot;\:\&amp;quot;),&lt;br /&gt;local!final2:substitute(insertkeyval(&amp;quot;place&amp;quot;,local!data["place"],&amp;quot;\&amp;quot;,&amp;quot;\&amp;quot;),&amp;quot;=&amp;quot;,&amp;quot;\:\&amp;quot;),&lt;br /&gt;local!data2:concat(local!final,&amp;quot;,&amp;quot;,local!final2),&lt;br /&gt;local!data2&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;sample output&amp;nbsp;&lt;i class="SelectableTreeNode---icon SelectableTreeNode---openCloseLink"&gt;&lt;/i&gt;&lt;span&gt;&lt;span class="CollapsibleOutputNode---print_value"&gt;&amp;quot;\name\:\Vivek\,\place\:\XYZ\&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Converting dictionary to a different JSON response</title><link>https://community.appian.com/thread/81022?ContentTypeID=1</link><pubDate>Tue, 20 Apr 2021 12:29:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0a4ab923-c78e-4767-9bc1-fc2f6ee77756</guid><dc:creator>vivekg0004</dc:creator><description>&lt;p&gt;The information helped. Thanks Stefan.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Converting dictionary to a different JSON response</title><link>https://community.appian.com/thread/81021?ContentTypeID=1</link><pubDate>Tue, 20 Apr 2021 12:17:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8857097e-60e6-4a5d-aca5-ed92d528d107</guid><dc:creator>vivekg0004</dc:creator><description>&lt;p&gt;Yes I want to escape the quotes in json string. Will the substitute function will help achieve this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Converting dictionary to a different JSON response</title><link>https://community.appian.com/thread/81020?ContentTypeID=1</link><pubDate>Tue, 20 Apr 2021 12:11:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3e3d89e1-9de4-44d9-9b36-9c2089b3e037</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;What is your use case?&lt;/p&gt;
&lt;p&gt;If you really need to do that, you can do a toJson() followed by a substitute() call to replace &amp;quot; with \&amp;quot;.&lt;/p&gt;
&lt;p&gt;Feels like you want to escape a JSON string. For this you would need to escape more characters.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/sql/relational-databases/json/how-for-json-escapes-special-characters-and-control-characters-sql-server?view=sql-server-ver15"&gt;docs.microsoft.com/.../how-for-json-escapes-special-characters-and-control-characters-sql-server&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>