<?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: Read Column Names and Extract JSON Data in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326530#M96012</link>
    <description>&lt;P&gt;Ah, I see. This is going to be tricky figuring out how you want to work with this data, but I can show you how to get the header data one header value at a time....&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-03-23 at 19.17.59.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LtC7.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/132870i9F079959FD74E4EF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LtC7.png" alt="0683p000009LtC7.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;This will return your column headers one row at a time. You can get a count here and each header name.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;To get the data you can do the following to get a "row". What this does is return the array structure one row at a time. So this essentially...&lt;/P&gt; 
&lt;PRE&gt;["0", null, "12345", "other"]
["1", "a", "54321", "MA"]
["0", null, "76543", "RI"]&lt;/PRE&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-03-23 at 19.18.20.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LssU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155163iCC96FB8BB31A91E7/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LssU.png" alt="0683p000009LssU.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;You can use a bit of simple Java String manipulation to extract this data into columns.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Mar 2018 19:24:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-03-23T19:24:32Z</dc:date>
    <item>
      <title>Read Column Names and Extract JSON Data</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326525#M96007</link>
      <description>&lt;P&gt;I have an&amp;nbsp;JSON object:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;{
	"RESULT_1": {
		"columns": ["col1", "col2", "col3", "col4"],
		"data": [
			["0", null, "12345", "other"],
			["1", "a", "54321", "MA"],
			["0", null, "76543", "RI"]
		]
	}
}&lt;/PRE&gt; 
&lt;P&gt;I am able to read the "data" part without issues using the tExtractJSONFields component.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CAPTURE_ONLY_DATA" style="width: 709px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LsvN.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/147292iAE55D5949511FCA2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LsvN.jpg" alt="0683p000009LsvN.jpg" /&gt;&lt;/span&gt;&lt;SPAN class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;CAPTURE_ONLY_DATA&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;However, I want to make sure that I read the column names from the "columns section" and make sure that the&amp;nbsp;correct data&amp;nbsp;is read and pushed in. For eg.&lt;/P&gt; 
&lt;P&gt;col1 should contain values 0,1,0&lt;/P&gt; 
&lt;P&gt;col2 should contain null, a, null&lt;/P&gt; 
&lt;P&gt;col3 should contain 12345, 54321, 76543&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;How can I achieve this?&amp;nbsp;Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 18:02:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326525#M96007</guid>
      <dc:creator>root</dc:creator>
      <dc:date>2018-03-21T18:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Read Column Names and Extract JSON Data</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326526#M96008</link>
      <description>&lt;P&gt;I *think* I understand what you want and here is an example of how it can be achieved.....&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-03-21 at 21.39.09.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Lt9X.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149472i5E93D0EEED90419E/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Lt9X.png" alt="0683p000009Lt9X.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The tFileInputJSON_1 retrieves the column names and is configured like this....&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-03-21 at 21.39.19.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LsuP.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134198i868EFCBF6626280E/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LsuP.png" alt="0683p000009LsuP.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;The tFileInputJSON_2 retrieves the&amp;nbsp;data columns&amp;nbsp;and is configured like this....&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-03-21 at 21.39.32.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Lt0D.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133896i7FF3A4471296DACB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Lt0D.png" alt="0683p000009Lt0D.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;You don't need to use&amp;nbsp;tFileInputJSON components for this, I just did as it made it quicker for me to try out. The logic will still work with the tExtractJSONField components.&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 21:44:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326526#M96008</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-21T21:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Read Column Names and Extract JSON Data</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326527#M96009</link>
      <description>&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;: Thank you. This makes sense and unite the rows/column together. But, how can I use the columns to make sure that the data is inserted correctly? I mean, tomorrow, if col3 comes before col1, (same for data also), then, I want to ensure that Talend is able to read the column names and save it correctly in a DB table. 
&lt;BR /&gt; 
&lt;BR /&gt;Thanks.</description>
      <pubDate>Thu, 22 Mar 2018 19:46:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326527#M96009</guid>
      <dc:creator>root</dc:creator>
      <dc:date>2018-03-22T19:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Read Column Names and Extract JSON Data</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326528#M96010</link>
      <description>&lt;P&gt;This problem sounds almost precisely like a problem I wrote a tutorial for a while ago. Take a look at this and see if it helps....&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.rilhia.com/tutorials/dynamic-column-order" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.rilhia.com/tutorials/dynamic-column-order&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 22:04:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326528#M96010</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-22T22:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Read Column Names and Extract JSON Data</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326529#M96011</link>
      <description>&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;: Thanks for sharing your article. My challenge is that twice already, a couple of columns were added, and now, as you know I am referring to each element using the array placeholder.. "[0]". So, if a column is added/ removed, I need to reconfigure the whole tExtractJsonFields structure.</description>
      <pubDate>Fri, 23 Mar 2018 17:55:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326529#M96011</guid>
      <dc:creator>root</dc:creator>
      <dc:date>2018-03-23T17:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Read Column Names and Extract JSON Data</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326530#M96012</link>
      <description>&lt;P&gt;Ah, I see. This is going to be tricky figuring out how you want to work with this data, but I can show you how to get the header data one header value at a time....&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-03-23 at 19.17.59.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LtC7.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/132870i9F079959FD74E4EF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LtC7.png" alt="0683p000009LtC7.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;This will return your column headers one row at a time. You can get a count here and each header name.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;To get the data you can do the following to get a "row". What this does is return the array structure one row at a time. So this essentially...&lt;/P&gt; 
&lt;PRE&gt;["0", null, "12345", "other"]
["1", "a", "54321", "MA"]
["0", null, "76543", "RI"]&lt;/PRE&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-03-23 at 19.18.20.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LssU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155163iCC96FB8BB31A91E7/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LssU.png" alt="0683p000009LssU.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;You can use a bit of simple Java String manipulation to extract this data into columns.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 19:24:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326530#M96012</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-23T19:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Read Column Names and Extract JSON Data</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326531#M96013</link>
      <description>&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;: Thanks. I think this may work... 
&lt;BR /&gt; 
&lt;BR /&gt;Am i correct in assuming that this will be done in tMssqlRow, slightly slower than consuming data directly via tMssqlOutput component? 
&lt;BR /&gt; 
&lt;BR /&gt;Thanks.</description>
      <pubDate>Tue, 27 Mar 2018 16:24:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326531#M96013</guid>
      <dc:creator>root</dc:creator>
      <dc:date>2018-03-27T16:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Read Column Names and Extract JSON Data</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326532#M96014</link>
      <description>&lt;P&gt;If your data is needed inside a database then yes, you could use a tMSSqlRow to dynamically create your update statements. However, you could also use a dynamic schema if you have the Enterprise Edition. However, this will mean that you will need your database to have every column you may possibly receive in your data. Alternatively (if you want to get really dynamic) you could create dynamic DDL statements and add new columns when they appear in your JSON. In this case you would need to use the tMSSqlRow component as your DB schema would not be known.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 17:06:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Read-Column-Names-and-Extract-JSON-Data/m-p/2326532#M96014</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-27T17:06:20Z</dc:date>
    </item>
  </channel>
</rss>

