<?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: JSON import nested object to relational tables in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/JSON-import-nested-object-to-relational-tables/m-p/2308775#M80064</link>
    <description>Hi
&lt;BR /&gt;Extract object_id first and store it to a context variable for used later, extract employee data another tExtractJsonFields and link it to a tMap, add the new column object_id in the output table.
&lt;BR /&gt;Regards
&lt;BR /&gt;Shong</description>
    <pubDate>Fri, 02 Sep 2016 09:05:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-09-02T09:05:38Z</dc:date>
    <item>
      <title>JSON import nested object to relational tables</title>
      <link>https://community.qlik.com/t5/Talend-Studio/JSON-import-nested-object-to-relational-tables/m-p/2308774#M80063</link>
      <description>&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;Hello, I am trying to import data from&amp;nbsp;&lt;B&gt;MongoDB&lt;/B&gt;&amp;nbsp;to a&amp;nbsp;&lt;B&gt;relational DB&lt;/B&gt;&amp;nbsp;(SQL Server).&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;I don't have access to the MongoDB components so I am querying my collection with the mongo java driver, in a tJava component.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;I get a:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;List&amp;lt; DBObject &amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt; 
&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;which I send to a tExtractJSONFields&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;An object of my collection looks like this:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;PRE&gt;,&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "customer":{&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"name":"Customer1",&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"custid":"test_réf"&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;BR /&gt; &amp;nbsp; }&lt;BR /&gt;]&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;For a sell, I can have several employees. I have an array of employee and I want to store the affected employee in another table. So I would have 2 tables:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;PRE&gt;Sell&lt;BR /&gt;oid &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp;shop &amp;nbsp;| &amp;nbsp;domain &amp;nbsp;| &amp;nbsp;zipCode &amp;nbsp;| ...&lt;BR /&gt;1564t8re13e4ter86 &amp;nbsp;| &amp;nbsp;shop1 | &amp;nbsp;Divers &amp;nbsp;| &amp;nbsp;58000 &amp;nbsp; &amp;nbsp;| ...&lt;BR /&gt;&lt;BR /&gt;Affected employee&lt;BR /&gt;employee_id &amp;nbsp;| &amp;nbsp;employee_name &amp;nbsp; | &amp;nbsp;oid&lt;BR /&gt;245975 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp;employee1 &amp;nbsp; &amp;nbsp; &amp;nbsp; | 1564t8re13e4ter86&lt;BR /&gt;458624 &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp;employee2 &amp;nbsp; &amp;nbsp; &amp;nbsp; | 1564t8re13e4ter86&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;So I want to loop on the employee array, with a Jsonpath query:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;"$.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;object.sell.employee"&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt; 
&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;The problem is that doing like this, I can't have the object_id. It seems that I can't get an attribute on a parent node if I define my Jsonpath query like this.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;I also saw that I can do like in the following link:&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;But I don't understand when does he get the object_id at the lower levels.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; 
&lt;BR /&gt; 
&lt;FONT color="#242729"&gt;&lt;FONT size="2"&gt;&lt;FONT face="Arial,"&gt;How can I do?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description>
      <pubDate>Wed, 31 Aug 2016 13:14:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/JSON-import-nested-object-to-relational-tables/m-p/2308774#M80063</guid>
      <dc:creator>gaston_guy</dc:creator>
      <dc:date>2016-08-31T13:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: JSON import nested object to relational tables</title>
      <link>https://community.qlik.com/t5/Talend-Studio/JSON-import-nested-object-to-relational-tables/m-p/2308775#M80064</link>
      <description>Hi
&lt;BR /&gt;Extract object_id first and store it to a context variable for used later, extract employee data another tExtractJsonFields and link it to a tMap, add the new column object_id in the output table.
&lt;BR /&gt;Regards
&lt;BR /&gt;Shong</description>
      <pubDate>Fri, 02 Sep 2016 09:05:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/JSON-import-nested-object-to-relational-tables/m-p/2308775#M80064</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-02T09:05:38Z</dc:date>
    </item>
  </channel>
</rss>

