<?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: How to get json element based on filtering in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334843#M103467</link>
    <description>&lt;P&gt;Thanks for the answer ! Tried it and it works (off course)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But why does the call to Google api https://maps.googleapis.com/maps/api/place/findplacefromtext return me a placeid, which I can extract like this :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000aDEFyAAO.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155347i71BFC077752AEA3C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000aDEFyAAO.png" alt="0695b00000aDEFyAAO.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this result doesn't have the "[.......]" characters surrounding the value of the field place_id &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a difference ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jacco&lt;/P&gt;</description>
    <pubDate>Wed, 30 Nov 2022 06:58:49 GMT</pubDate>
    <dc:creator>Jacco_De_Zwart</dc:creator>
    <dc:date>2022-11-30T06:58:49Z</dc:date>
    <item>
      <title>How to get json element based on filtering</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334839#M103463</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I send a request to Google places API, I get the following json result :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"html_attributions" : [],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"result" : {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;"address_components" : [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"long_name" : "55/1",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"short_name" : "55/1",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"types" : [ "street_number" ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"long_name" : "Heidenheimer Straße",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"short_name" : "Heidenheimer Str.",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"types" : [ "route" ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"long_name" : "Ulm",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"short_name" : "Ulm",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"types" : [ "locality", "political" ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"long_name" : "Kreisfreie Stadt Ulm",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"short_name" : "Kreisfreie Stadt Ulm",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"types" : [ "administrative_area_level_3", "political" ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"long_name" : "Tübingen",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"short_name" : "TÜ",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"types" : [ "administrative_area_level_2", "political" ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"long_name" : "Baden-Württemberg",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"short_name" : "BW",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"types" : [ "administrative_area_level_1", "political" ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"long_name" : "Germany",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"short_name" : "DE",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"types" : [ "country", "political" ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"long_name" : "89075",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"short_name" : "89075",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"types" : [ "postal_code" ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;"status" : "OK"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next step is that I use tExtactJSONFields to get the individual elements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I copy the result in jsonpath.com to see how to get the elements, I can get each individual element by using :&lt;/P&gt;&lt;P&gt;$..address_components[?(@.types.indexOf('street_number') != -1)].[long_name]  &lt;/P&gt;&lt;P&gt;and so on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the tExtractJSONField it looks like this :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z3HAOAA3.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133045i6D76E832633561D7/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z3HAOAA3.png" alt="0695b00000Z3HAOAA3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and in the advanced settings 'Use the loop node as root'  is checked.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z3HAYAA3.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/142853iD0653BFF1732EA9C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z3HAYAA3.png" alt="0695b00000Z3HAYAA3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run the job i get the error&lt;/P&gt;&lt;P&gt;Could not compile inline filter : [?(@.types.indexOf('street_number') != -1)]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So two questions :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;What is wrong with this code ? It works fine in jsonpath.com&lt;/LI&gt;&lt;LI&gt;What other way is there to get the individual elements ?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jacco&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 22:19:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334839#M103463</guid>
      <dc:creator>Jacco_De_Zwart</dc:creator>
      <dc:date>2024-11-15T22:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get json element based on filtering</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334840#M103464</link>
      <description>&lt;P&gt;There are different implementations of JSONPath unfortunately. At the moment "indexOf" is not supported in the libraries we are using. However, this can resolved with a slightly different syntax. I have tested this and it works with your example JSON.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, your loop path will need to be ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"$.result"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will prevent the component from looping over the array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then your JSONPath queries will need to be in this format....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"address_components[?('street_number' in @.types)].long_name"&lt;/P&gt;&lt;P&gt;"address_components[?('route' in @.types)].long_name"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You'll see that the two examples are essentially the same, just with different search criteria of "street_number" and "route".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested this and it works as I believe you want it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Nov 2022 00:43:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334840#M103464</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-26T00:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get json element based on filtering</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334841#M103465</link>
      <description>&lt;P&gt;@Richard Hall​&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I rewrite my to according to your suggestion and it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000Z3RFTAA3.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138820i16566237C8CB0E4A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000Z3RFTAA3.png" alt="0695b00000Z3RFTAA3.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only thing that I have now is that the result looks like (in tlog output):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;["3"]|["Telitie"]|["Hyrylä"]|["04300"]|[]|["FI"]&lt;/P&gt;&lt;P&gt;["2"]|["Tavernierkaai"]|["Antwerpen"]|["2000"]|["Vlaams Gewest"]|["BE"]&lt;/P&gt;&lt;P&gt;["8"]|["Im Stadtfelde"]|["Wunstorf"]|["31515"]|["Niedersachsen"]|["DE"]&lt;/P&gt;&lt;P&gt;["3"]|["Brookstieg"]|["Stapelfeld"]|["22145"]|["Schleswig-Holstein"]|["DE"]&lt;/P&gt;&lt;P&gt;["700"]|["Churchilllaan"]|["Terneuzen"]|["4532 JB"]|["Zeeland"]|["NL"]&lt;/P&gt;&lt;P&gt;["29"]|["Baindter Straße"]|["Baienfurt"]|["88255"]|["Baden-Württemberg"]|["DE"]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why are there still the brackets [ and ]  and the dobble quotes in the result ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jacco&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 07:08:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334841#M103465</guid>
      <dc:creator>Jacco_De_Zwart</dc:creator>
      <dc:date>2022-11-28T07:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to get json element based on filtering</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334842#M103466</link>
      <description>&lt;P&gt;OK, this is a little trickier. But it can be done. In the next component, you will need to process each column using the following code using regex.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;row.column.replaceAll("((^\\[\")|(\"\\]$))|((^\\[)|(\\]$))", "")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy this exactly. What it does is it looks for values with [" and "] at the beginning and end of the String and also looks for just [ and ] at the beginning and end of the String.  This will deal with that issue.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 00:07:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334842#M103466</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-29T00:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get json element based on filtering</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334843#M103467</link>
      <description>&lt;P&gt;Thanks for the answer ! Tried it and it works (off course)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But why does the call to Google api https://maps.googleapis.com/maps/api/place/findplacefromtext return me a placeid, which I can extract like this :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000aDEFyAAO.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155347i71BFC077752AEA3C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000aDEFyAAO.png" alt="0695b00000aDEFyAAO.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this result doesn't have the "[.......]" characters surrounding the value of the field place_id &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a difference ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jacco&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 06:58:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334843#M103467</guid>
      <dc:creator>Jacco_De_Zwart</dc:creator>
      <dc:date>2022-11-30T06:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get json element based on filtering</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334844#M103468</link>
      <description>&lt;P&gt;This is because you are selecting a single item from an individual array element. You are using the Loop JSONPath query to iterate over the array elements in the image above. In the example I gave you (based on your initial attempt to get the data), you are selecting from the whole array. As such, the record is returned as an array as it *could* match more than one value.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 10:56:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334844#M103468</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-30T10:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get json element based on filtering</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334845#M103469</link>
      <description>&lt;P&gt;Thanks again. I will experiment a bit more with this.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 11:40:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-get-json-element-based-on-filtering/m-p/2334845#M103469</guid>
      <dc:creator>Jacco_De_Zwart</dc:creator>
      <dc:date>2022-11-30T11:40:31Z</dc:date>
    </item>
  </channel>
</rss>

