<?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: tExtractJsonFields - accessing a sibling field at the same level as the loop in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tExtractJsonFields-accessing-a-sibling-field-at-the-same-level/m-p/2287480#M61060</link>
    <description>Thanks 
&lt;BR /&gt;Didn't realize you could you xpath against a json input. Nice trick to remember.</description>
    <pubDate>Tue, 08 Aug 2017 03:55:33 GMT</pubDate>
    <dc:creator>DaveTaylor</dc:creator>
    <dc:date>2017-08-08T03:55:33Z</dc:date>
    <item>
      <title>tExtractJsonFields - accessing a sibling field at the same level as the loop</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractJsonFields-accessing-a-sibling-field-at-the-same-level/m-p/2287478#M61058</link>
      <description>&lt;P&gt;sample json:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;{
"response": {
"code": "200",
"description": "SUCCESS",
"type": "SUCCESS"
},
"agentPartyID": "XLB91",
"agencyId": "X0945",
"agencyName": "CRUMP LIFE INSURANCE",
"producerHierarchy": [{
   "primaryAgentPartyID": "XLB92"
   }, {
   "primaryAgentPartyID": "SM001"
   }, {
   "primaryAgentPartyID": "BBBBBBBBBB"
   }, {
   "primaryAgentPartyID": "X0559"
   }, {
   "primaryAgentPartyID": "X0945"
   }, {
   "primaryAgentPartyID": "FV062"
  }
]
}&lt;/PRE&gt; 
&lt;P&gt;I have other fields within the producerHierarchy loop besides the primaryAgentPartyID field; I just removed them for brevity.&lt;/P&gt; 
&lt;P&gt;Read By: JsonPath&lt;BR /&gt;Loop Jsonpath query:&amp;nbsp;"$.producerHierarchy[*]"&lt;/P&gt; 
&lt;P&gt;Mapping:&lt;BR /&gt;Column &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Json query&lt;/P&gt; 
&lt;P&gt;primaryAgentPartyID &amp;nbsp; &amp;nbsp;"primaryAgentPartyID"&lt;/P&gt; 
&lt;P&gt;agentPartyID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "../agentPartyID"&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;When I run the job; and the step executes; and I review the LogRow; it successfully finds all the&amp;nbsp;primaryAgentPartyIDs; but the agentPartyID is blank. &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Are you not allowed to recurse up the jsonpath chain above the loop field?&lt;BR /&gt;&lt;BR /&gt;I've tried several jsonpath formats on the agentPartyID field; trying to get it included; but no luck. &amp;nbsp;I would like my output to look like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt; 
&lt;PRE&gt;|=-----------+--------------+-----
|primaryAgentPartyID|agentPartyID|
|=-----------+--------------+-----
|XLB92              |XLB91       |
|SM001              |XLB91       |
|BBBBBBBBBB         |XLB91       |
|X0559              |XLB91       |
|X0945              |XLB91       |
|FV062              |XLB91       |
'------------+--------------+-----&lt;/PRE&gt; 
&lt;P&gt;I feel like this should be simple; but I'm not seeing it.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 00:29:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractJsonFields-accessing-a-sibling-field-at-the-same-level/m-p/2287478#M61058</guid>
      <dc:creator>DaveTaylor</dc:creator>
      <dc:date>2017-08-08T00:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractJsonFields - accessing a sibling field at the same level as the loop</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractJsonFields-accessing-a-sibling-field-at-the-same-level/m-p/2287479#M61059</link>
      <description>&lt;P&gt;Change your component to use XPath instead of JSONPath and use the following XPath config...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Loop : "/producerHierarchy"&lt;/P&gt;
&lt;P&gt;Mapping:&lt;BR /&gt;Column &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XPath&amp;nbsp;query&lt;/P&gt;
&lt;P&gt;primaryAgentPartyID &amp;nbsp; "./primaryAgentPartyID"&lt;/P&gt;
&lt;P&gt;agentPartyID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "../agentPartyID"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will do exactly what you want.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 01:27:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractJsonFields-accessing-a-sibling-field-at-the-same-level/m-p/2287479#M61059</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-08T01:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractJsonFields - accessing a sibling field at the same level as the loop</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractJsonFields-accessing-a-sibling-field-at-the-same-level/m-p/2287480#M61060</link>
      <description>Thanks 
&lt;BR /&gt;Didn't realize you could you xpath against a json input. Nice trick to remember.</description>
      <pubDate>Tue, 08 Aug 2017 03:55:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractJsonFields-accessing-a-sibling-field-at-the-same-level/m-p/2287480#M61060</guid>
      <dc:creator>DaveTaylor</dc:creator>
      <dc:date>2017-08-08T03:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: tExtractJsonFields - accessing a sibling field at the same level as the loop</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tExtractJsonFields-accessing-a-sibling-field-at-the-same-level/m-p/2287481#M61061</link>
      <description>&lt;P&gt;Can this be done using Read by : JsonPath rather than Xpath? The issue that I am facing is&amp;nbsp;in my output one of the element is named as "mime_type$string" this is causing the job to break and I get following error "Error on line 28 of document&amp;nbsp; : Element type "mime_type" must be followed by either attribute specifications, "&amp;gt;" or "/&amp;gt;". Nested exception: Element type "mime_type" must be followed by either attribute specifications, "&amp;gt;" or "/&amp;gt;"."&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 11:04:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tExtractJsonFields-accessing-a-sibling-field-at-the-same-level/m-p/2287481#M61061</guid>
      <dc:creator>Gourav_King_of_DataLand</dc:creator>
      <dc:date>2018-08-17T11:04:27Z</dc:date>
    </item>
  </channel>
</rss>

