<?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: Web Services - Json Path in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73575#M26180</link>
    <description>Hi &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/51621"&gt;@TomasKochan2&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;When you say a collection failed at run time did you try making the data item type Collection and then setting the JSON Path to just &lt;STRONG&gt;$&lt;/STRONG&gt;? That should parse the entire JSON into the output Collection.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;&lt;LI&gt;&lt;STRONG&gt;.address.zipcode&lt;/STRONG&gt; would fail to convert to a Collection because Blue Prism expects to see the element name to use for naming the column in the Collection. In this case the matching values are just the zip codes themselves.&lt;BR /&gt;&lt;BR /&gt;You could try using just &lt;STRONG&gt;$&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;.address&lt;/STRONG&gt; mapped to a Collection data item. That would give you just the address values and then you could refence the zips as a column in the Collection.&amp;nbsp;&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;&lt;/LI&gt;</description>
    <pubDate>Fri, 10 Jun 2022 15:44:00 GMT</pubDate>
    <dc:creator>ewilson</dc:creator>
    <dc:date>2022-06-10T15:44:00Z</dc:date>
    <item>
      <title>Web Services - Json Path</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73574#M26179</link>
      <description>&lt;P&gt;Hi, I'd like to extract a collection of zip codes from a JSON response such as:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://jsonplaceholder.typicode.com/users" target="_blank" rel="noopener"&gt;https://jsonplaceholder.typicode.com/users&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;[
  {
    "id": 1,
    "name": "Leanne Graham",
    "username": "Bret",
    "email": "Sincere@april.biz",
    "address": {
      "street": "Kulas Light",
      "suite": "Apt. 556",
      "city": "Gwenborough",
      "zipcode": "92998-3874",
      "geo": {
        "lat": "-37.3159",
        "lng": "81.1496"
      }
    },
    "phone": "1-770-736-8031 x56442",
    "website": "hildegard.org",
    "company": {
      "name": "Romaguera-Crona",
      "catchPhrase": "Multi-layered client-server neural-net",
      "bs": "harness real-time e-markets"
    }
  },
  {
    "id": 2,
    "name": "Ervin Howell",
    "username": "Antonette",
    "email": "Shanna@melissa.tv",
    "address": {
      "street": "Victor Plains",
      "suite": "Suite 879",
      "city": "Wisokyburgh",
      "zipcode": "90566-7771",
      "geo": {
        "lat": "-43.9509",
        "lng": "-34.4618"
      }
    },
    "phone": "010-692-6593 x09125",
    "website": "anastasia.net",
    "company": {
      "name": "Deckow-Crist",
      "catchPhrase": "Proactive didactic contingency",
      "bs": "synergize scalable supply-chains"
    }
  }
]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;I can get single value but a collection fails at run time, though compiler didn't find syntax error.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="15221.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/15385iD3EAD661B548078D/image-size/large?v=v2&amp;amp;px=999" role="button" title="15221.png" alt="15221.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I tried &lt;STRONG&gt;$[?(@.address.zipcode)]&amp;nbsp;&lt;/STRONG&gt;which also results in error.&lt;BR /&gt;Could someone please advise the correct query?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Tomas Kochan&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 10 Jun 2022 14:55:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73574#M26179</guid>
      <dc:creator>TomasKochan1</dc:creator>
      <dc:date>2022-06-10T14:55:00Z</dc:date>
    </item>
    <item>
      <title>RE: Web Services - Json Path</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73575#M26180</link>
      <description>Hi &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/51621"&gt;@TomasKochan2&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;When you say a collection failed at run time did you try making the data item type Collection and then setting the JSON Path to just &lt;STRONG&gt;$&lt;/STRONG&gt;? That should parse the entire JSON into the output Collection.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;&lt;LI&gt;&lt;STRONG&gt;.address.zipcode&lt;/STRONG&gt; would fail to convert to a Collection because Blue Prism expects to see the element name to use for naming the column in the Collection. In this case the matching values are just the zip codes themselves.&lt;BR /&gt;&lt;BR /&gt;You could try using just &lt;STRONG&gt;$&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;.address&lt;/STRONG&gt; mapped to a Collection data item. That would give you just the address values and then you could refence the zips as a column in the Collection.&amp;nbsp;&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;&lt;/LI&gt;</description>
      <pubDate>Fri, 10 Jun 2022 15:44:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73575#M26180</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2022-06-10T15:44:00Z</dc:date>
    </item>
    <item>
      <title>RE: Web Services - Json Path</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73576#M26181</link>
      <description>Thank you &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/833"&gt;@ewilson&lt;/a&gt;,&lt;BR /&gt;&lt;STRONG&gt;$ &lt;/STRONG&gt;works, but &lt;STRONG&gt;* &lt;/STRONG&gt;or &lt;STRONG&gt;?() &lt;/STRONG&gt;operators don't seem to work or I miss something.&lt;BR /&gt;Recently I tried:&lt;BR /&gt;- with defined and undefined output collection&lt;BR /&gt;- to serve same data by my localhost, but ​assigned key to that anonymous array like follows:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="15208.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/15371i87CC9A0854B198AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="15208.png" alt="15208.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&amp;gt; so then I would refer as&amp;nbsp;&lt;STRONG&gt;$.tomas_test&lt;/STRONG&gt;&lt;LI&gt;&lt;STRONG&gt;.address&amp;nbsp;&lt;/STRONG&gt;but still receiving:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="15209.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/15370iBF88E4DFDCEBE91A/image-size/large?v=v2&amp;amp;px=999" role="button" title="15209.png" alt="15209.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I shouldn't parse all data to nested collection using&amp;nbsp;&lt;STRONG&gt;$&amp;nbsp;&lt;/STRONG&gt;root selector, as real data might reach collection limit.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Tomas Kochan&lt;BR /&gt;------------------------------&lt;BR /&gt;&lt;/LI&gt;</description>
      <pubDate>Fri, 10 Jun 2022 16:16:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73576#M26181</guid>
      <dc:creator>TomasKochan1</dc:creator>
      <dc:date>2022-06-10T16:16:00Z</dc:date>
    </item>
    <item>
      <title>RE: Web Services - Json Path</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73577#M26182</link>
      <description>Just tried examples from Docs on the same data set they provide:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="15211.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/15376iBF17D7085624AB38/image-size/large?v=v2&amp;amp;px=999" role="button" title="15211.png" alt="15211.png" /&gt;&lt;/span&gt;- only 2nd and last work.&lt;BR /&gt;Most of the time, we receive large JSON array from endpoint. It'd be very helpful to successfully extract wanted values straight to a collection.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Tomas Kochan&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 10 Jun 2022 16:50:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73577#M26182</guid>
      <dc:creator>TomasKochan1</dc:creator>
      <dc:date>2022-06-10T16:50:00Z</dc:date>
    </item>
    <item>
      <title>RE: Web Services - Json Path</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73578#M26183</link>
      <description>Hi &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/51621"&gt;@TomasKochan2&lt;/a&gt;,&lt;BR /&gt;​&lt;BR /&gt;I've spent some time looking at this further. I think the only way you're going to be able to whittle this down to just the zipcode values is to use custom code and parse the JSON yourself. Here's an example of some code I threw together that does just that.&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE class="language-csharp"&gt;&lt;CODE&gt;JArray jsonText = JArray.Parse(Response_Content);

DataTable dtZipCodes = new DataTable();

DataColumn column = new DataColumn("zipcode");
column.DataType = System.Type.GetType("System.String");
dtZipCodes.Columns.Add(column);

IEnumerable&amp;lt;JToken&amp;gt; zips = jsonText.SelectTokens("&lt;/CODE&gt;&lt;LI&gt;&lt;CODE&gt;.address.zipcode");
foreach (JToken zipcode in zips)
{
	DataRow row = dtZipCodes.NewRow();
	row["zipcode"] = (string)zipcode;
	dtZipCodes.Rows.Add(row);
}

ZipCodes = dtZipCodes;​&lt;/CODE&gt;&lt;/LI&gt;&lt;/PRE&gt;
&lt;BR /&gt;And here are some screenshots of the Web API definition and the Global Code section where you need to add a couple DLL and namespace references:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="15215.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/15381i8A694B6465DC29A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="15215.png" alt="15215.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="15216.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/15380iCF4CE706BDD118C8/image-size/large?v=v2&amp;amp;px=999" role="button" title="15216.png" alt="15216.png" /&gt;&lt;/span&gt;&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>Tue, 14 Jun 2022 16:17:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Web-Services-Json-Path/m-p/73578#M26183</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2022-06-14T16:17:00Z</dc:date>
    </item>
  </channel>
</rss>

