<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic RE: In case any one else would like to have their Web API json returned as a collection. in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93589#M43106</link>
    <description>Amazing solutions on display there &lt;A class="user-content-mention" data-sign="@" data-contactkey="b7a2be6d-c554-42d3-b938-f472b1b3cfc2" data-tag-text="@Tracy Schultz" href="https://community.blueprism.com/network/profile?UserKey=b7a2be6d-c554-42d3-b938-f472b1b3cfc2" data-itemmentionkey="0947924c-9dd6-454b-ac52-032f8e9ecc36"&gt;@Tracy Schultz&lt;/A&gt; and &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/833"&gt;@ewilson&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks for sharing with us &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;​​&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;----------------------------------&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Devneet Mohanty&lt;BR /&gt;Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,&lt;BR /&gt;Wonderbotz India Pvt. Ltd.&lt;BR /&gt;Blue Prism Community MVP | Blue Prism 7x Certified Professional&lt;BR /&gt;Website: &lt;A href="https://devneet.github.io/" target="test_blank"&gt;https://devneet.github.io/&lt;/A&gt;&lt;BR /&gt;Email: devneetmohanty07@gmail.com&lt;BR /&gt;&lt;BR /&gt;----------------------------------&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Fri, 04 Feb 2022 09:30:00 GMT</pubDate>
    <dc:creator>devneetmohanty07</dc:creator>
    <dc:date>2022-02-04T09:30:00Z</dc:date>
    <item>
      <title>In case any one else would like to have their Web API json returned as a collection.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93586#M43103</link>
      <description>&lt;A data-tag-text="code" data-sign="#" class="user-content-hashtag" href="https://community.blueprism.com/search?s=%23code&amp;amp;executesearch=true" data-tag-key="0740778a-ed76-47b2-a5c0-610eaeb8e941"&gt;#code&lt;/A&gt; &lt;A data-tag-text="json" data-sign="#" class="user-content-hashtag" href="https://community.blueprism.com/search?s=%23json&amp;amp;executesearch=true" data-tag-key="e5705e85-315f-45a2-b74f-f525a9e6a6e3"&gt;#json&lt;/A&gt; &lt;A data-tag-text="webapi" data-sign="#" class="user-content-hashtag" href="https://community.blueprism.com/search?s=%23webapi&amp;amp;executesearch=true" data-tag-key="14ffc8df-2915-4c38-8341-186cd71f4646"&gt;#webapi&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I know I've run into situations where I am getting multiple records returned in my JSON response&lt;BR /&gt;Below is how I've set it up so the Result Content is returned as a collection.
&lt;H3&gt;&lt;STRONG&gt;Common Code&lt;/STRONG&gt;&lt;/H3&gt;
&lt;H5&gt;&lt;STRONG&gt;Code Options&lt;/STRONG&gt;&lt;/H5&gt;
&lt;P&gt;Add the DLL&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;EM&gt;Newtonsoft.Json.dll&lt;/EM&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Add the Namespace Imports&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;EM&gt;Newtonsoft.Json&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Newtonsoft.Json.Linq&lt;/EM&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;H5&gt;&lt;STRONG&gt;Shared Code&lt;BR /&gt;&lt;/STRONG&gt;&lt;/H5&gt;
&lt;PRE class="language-csharp"&gt;&lt;CODE&gt;public class JSONResults {
	//Class variables
		private string input;

	//Constructor
		public JSONResults (string input){
			this.input = input;
		}

	//Property
		public DataTable Results { get
			{
				DataTable dt = new DataTable();
				dt = JsonConvert.DeserializeObject&amp;lt;DataTable&amp;gt;(input);
				return dt;
			}
		}
	}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;H5&gt;&lt;STRONG&gt;API Action&lt;/STRONG&gt;&lt;/H5&gt;
In Response past the following into your custom code area.
&lt;PRE class="language-csharp"&gt;&lt;CODE&gt;JSONResults results = new JSONResults(Response_Content);
Results = results.Results;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Tracy Schultz&lt;BR /&gt;Weaver LLC&lt;BR /&gt;TX&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Feb 2022 20:20:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93586#M43103</guid>
      <dc:creator>TracySchultz</dc:creator>
      <dc:date>2022-02-03T20:20:00Z</dc:date>
    </item>
    <item>
      <title>RE: In case any one else would like to have their Web API json returned as a collection.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93587#M43104</link>
      <description>Thanks for share, &lt;A class="user-content-mention" data-sign="@" data-contactkey="b7a2be6d-c554-42d3-b938-f472b1b3cfc2" data-tag-text="@Tracy Schultz" href="https://community.blueprism.com/network/profile?UserKey=b7a2be6d-c554-42d3-b938-f472b1b3cfc2" data-itemmentionkey="a5f064ca-cb34-40aa-8740-8e91c7f0ca06"&gt;@Tracy Schultz&lt;/A&gt;​&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Jhogel Ponne&lt;BR /&gt;Senior RPA&lt;BR /&gt;Ernst &amp;amp; Young&lt;BR /&gt;America/Panama&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Feb 2022 23:47:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93587#M43104</guid>
      <dc:creator>jhogelp</dc:creator>
      <dc:date>2022-02-03T23:47:00Z</dc:date>
    </item>
    <item>
      <title>RE: In case any one else would like to have their Web API json returned as a collection.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93588#M43105</link>
      <description>Hi &lt;A class="user-content-mention" data-sign="@" data-contactkey="b7a2be6d-c554-42d3-b938-f472b1b3cfc2" data-tag-text="@Tracy Schultz" href="https://community.blueprism.com/network/profile?UserKey=b7a2be6d-c554-42d3-b938-f472b1b3cfc2" data-itemmentionkey="5737f2e2-08b0-4828-a3c1-461ee01031dd"&gt;@Tracy Schultz&lt;/A&gt;,&lt;BR /&gt;&lt;BR /&gt;This is good stuff. Normally, I just define a Collection output item and then use JSON Path as the method and set the value to &lt;STRONG&gt;$&lt;/STRONG&gt; (which is the root object or array). This usually works well except in situations where an array of objects is returned and some property on the first object is set to &lt;STRONG&gt;null&lt;/STRONG&gt; but in a later object it's populated with an actual type-value like &lt;STRONG&gt;true&lt;/STRONG&gt; (boolean). Then you end up with an exception of the JSON Path processing.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="19774.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/19921i7B70CCB6122E1BDF/image-size/large?v=v2&amp;amp;px=999" role="button" title="19774.png" alt="19774.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I'm thinking you could address that with your approach as you have more control. So you could actually set up serializer settings. Something like this:&lt;BR /&gt;
&lt;PRE class="language-csharp"&gt;&lt;CODE&gt;public class JSONResults {
  // Class variables
  private string input;
  private JsonSerializerSettings settings = new JsonSerializerSettings														                
  {														                        
    NullValueHandling = NullValueHandling.Ignore,														                        
    MissingMemberHandling = MissingMemberHandling.Ignore														                    
  };

  // Constructor
  public JSONResults (string input) {
		this.input = input;
  }

  // Property
  public DataTable Results { get
  {
    DataTable dt = new DataTable();
    dt = JsonConvert.DeserializeObject&amp;lt;DataTable&amp;gt;(input, settings);
    return dt; }
  }
}
​&lt;/CODE&gt;&lt;/PRE&gt;
&amp;nbsp;&lt;BR /&gt;What do you think?&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Eric Wilson&lt;BR /&gt;Director, Integrations and Enablement&lt;BR /&gt;Blue Prism Digital Exchange&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Feb 2022 23:57:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93588#M43105</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2022-02-03T23:57:00Z</dc:date>
    </item>
    <item>
      <title>RE: In case any one else would like to have their Web API json returned as a collection.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93589#M43106</link>
      <description>Amazing solutions on display there &lt;A class="user-content-mention" data-sign="@" data-contactkey="b7a2be6d-c554-42d3-b938-f472b1b3cfc2" data-tag-text="@Tracy Schultz" href="https://community.blueprism.com/network/profile?UserKey=b7a2be6d-c554-42d3-b938-f472b1b3cfc2" data-itemmentionkey="0947924c-9dd6-454b-ac52-032f8e9ecc36"&gt;@Tracy Schultz&lt;/A&gt; and &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/833"&gt;@ewilson&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks for sharing with us &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;​​&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;----------------------------------&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Devneet Mohanty&lt;BR /&gt;Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,&lt;BR /&gt;Wonderbotz India Pvt. Ltd.&lt;BR /&gt;Blue Prism Community MVP | Blue Prism 7x Certified Professional&lt;BR /&gt;Website: &lt;A href="https://devneet.github.io/" target="test_blank"&gt;https://devneet.github.io/&lt;/A&gt;&lt;BR /&gt;Email: devneetmohanty07@gmail.com&lt;BR /&gt;&lt;BR /&gt;----------------------------------&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Feb 2022 09:30:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93589#M43106</guid>
      <dc:creator>devneetmohanty07</dc:creator>
      <dc:date>2022-02-04T09:30:00Z</dc:date>
    </item>
    <item>
      <title>RE: In case any one else would like to have their Web API json returned as a collection.</title>
      <link>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93590#M43107</link>
      <description>Looks good, my only current issue is nested JSON isn't working with what I supplied.&lt;BR /&gt;&lt;BR /&gt;I am and was aiming for a general collection returned as I'm frequently interacting with API's and getting large amounts of data back and while I can just work with the RC it's one less step to get it all back as a collection.&lt;BR /&gt;&lt;BR /&gt;My ideal would be to pass in a collection that defines the JSON values, including nested items, and then passes back a correctly formatted collection, possibly even filtering out unwanted columns.&lt;BR /&gt;&lt;BR /&gt;In the mean time this works.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Tracy Schultz&lt;BR /&gt;Weaver LLC&lt;BR /&gt;TX&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Feb 2022 18:04:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/In-case-any-one-else-would-like-to-have-their-Web-API-json/m-p/93590#M43107</guid>
      <dc:creator>TracySchultz</dc:creator>
      <dc:date>2022-02-04T18:04:00Z</dc:date>
    </item>
  </channel>
</rss>

