<?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 extract values from Dynamic JSON fields? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208554#M7724</link>
    <description>&lt;P&gt;You will need to use v7.2 to open it. I used TOS ESB v7.2.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Dec 2019 11:44:25 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-12-13T11:44:25Z</dc:date>
    <item>
      <title>How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208549#M7719</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;
&lt;P&gt;Good day!&lt;/P&gt;
&lt;P&gt;I am new to Talend and badly needed your help. I have this job that consist of the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1st subjob:&lt;BR /&gt;processing logic -&amp;gt; tHashOutput (contains invoice and other fields)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2nd subjob:&lt;BR /&gt;Hash (contains the source of AggGrp - see attachment Source and Expected Output.json) -&amp;gt; tMap (to create JSON RequestBody) -&amp;gt; tAggregateRow (to get only the last generated string) -&amp;gt; tReplicate -&amp;gt; RestClient1 and RestClient2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can get the response from both of these successfully. The problem is that they have dynamic JSON fields (doesn't look like a JSON field but a value).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see attached Response_1.json and Response_2.json for RestClient1 and RestClient2, respectively.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I extract these fields and process them to these:&lt;/P&gt;
&lt;P&gt;Source and Expected Output.json&lt;BR /&gt;(This includes both Source and expected output)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. There are also descriptions on the files on how it will be mapped. Let me know if you need more info.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me. Thank you so much.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:52:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208549#M7719</guid>
      <dc:creator>jerownimow</dc:creator>
      <dc:date>2024-11-16T03:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208550#M7720</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&amp;nbsp;,&lt;BR /&gt;Good day! sorry to bother you again. Seems that your solution in here &lt;A href="https://community.qlik.com/s/feed/0D53p00007vCjGsCAK" target="_self"&gt;Parse hashmap inside a json&lt;/A&gt;&amp;nbsp; will work on my problem but I don't know how to execute it. I'm quite confused with point 1 and the output myColumn. On the issue posted, he wants 2 outputs both the key and the value if I'm not mistaken.&lt;BR /&gt;&lt;BR /&gt;Can you please explain it to me like you explained the tJavaFlex on my other post?&lt;BR /&gt;&lt;BR /&gt;Thank you so much.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 04:13:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208550#M7720</guid>
      <dc:creator>jerownimow</dc:creator>
      <dc:date>2019-12-12T04:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208551#M7721</link>
      <description>&lt;P&gt;This is incredibly hard for someone who is new. If you do not have any Java knowledge, this will make it almost impossible to describe here. So I have built a job using TOS 7.2. This will extract the data from Response1.txt. I have had to download the org.json Jar and import it into the job. You will probably need to do this on your side (I don't believe my export will include that). There is a tLibraryLoad component which needs to have this Jar configured. You can find the Jar here:&amp;nbsp;&lt;A href="https://jar-download.com/artifacts/org.json" target="_blank" rel="nofollow noopener noreferrer"&gt;https://jar-download.com/artifacts/org.json&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I hope this helps. Unfortunately I cannot spend a great deal more time on this problem. Hopefully you can extrapolate from this if you need to do more. If not, you will need to find a friendly Java developer to help you with this. By the way, Java is REALLY useful with Talend &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009Lx51"&gt;DynamicJSON.zip&lt;/A&gt;</description>
      <pubDate>Thu, 12 Dec 2019 11:45:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208551#M7721</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-12T11:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208552#M7722</link>
      <description>&lt;P&gt;No worries&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&amp;nbsp;. Thank you so much for your time. Any online trainings if there's free or readable materials you can recommend for me to learn java? &lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;Also, I got an error when tried to export the job. It says that 'Job Designs GetDynamicJSON 0.1' The item 'Job Designs GetDynamicJSON 0.1' from project 'Local_Project' was invalid.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 00:26:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208552#M7722</guid>
      <dc:creator>jerownimow</dc:creator>
      <dc:date>2019-12-13T00:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208553#M7723</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&amp;nbsp; seems that it is not compatible with my studio TOS for Big Data 7.1.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 09:39:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208553#M7723</guid>
      <dc:creator>jerownimow</dc:creator>
      <dc:date>2019-12-13T09:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208554#M7724</link>
      <description>&lt;P&gt;You will need to use v7.2 to open it. I used TOS ESB v7.2.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 11:44:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208554#M7724</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-13T11:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208555#M7725</link>
      <description>&lt;P&gt;Sorry, I've had a lot of alerts to go through and I am responding in order. I've just noticed you sent me another message. As I said, try installing v7.2 and the job should import. With regard to learning Java, there are loads of online methods. Depending on your level of existing experience, there are different options. For an absolute beginner, I would recommend this approach&amp;nbsp;&lt;A href="https://www.bluej.org/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.bluej.org/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 11:50:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208555#M7725</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-13T11:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208556#M7726</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;No problem. Sorry for the spam, I didn't noticed that you already had a reply.&lt;BR /&gt;Unfortunately, I am not able to have 7.2 on my PC. Is it possible to just send me the screenshots like you did on the other thread we have?&lt;BR /&gt;&lt;BR /&gt;Sorry for requesting this much and thank you for your tips! Will definitely grind on that.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 12:32:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208556#M7726</guid>
      <dc:creator>jerownimow</dc:creator>
      <dc:date>2019-12-13T12:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208557#M7727</link>
      <description>&lt;P&gt;OK, here are some screenshots and the code I used.....&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="Screenshot 2019-12-13 at 13.23.54.png" style="width: 730px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8Kf.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/132319iA5F0CD898DE05A94/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8Kf.png" alt="0683p000009M8Kf.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;The tLibraryLoad component needs the Jar file I mentioned in my earlier post. After configuring that, you will need to set the other components up then save, close the job, then re-open the job. This is a *feature* that some people experience with Java libraries not being "seen" by the job. Hopefully you will not have any issues there.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The tFileInputJSON component is configured like below....&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2019-12-13 at 13.24.16.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8Kk.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146292i88D2E2074BEC6EFB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8Kk.png" alt="0683p000009M8Kk.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Essentially you are passing the whole JSON from the file to the next component in one go.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The tJavaFlex config can be seen below. I am just including the code. You can figure out the schema from the code. This must be copied and pasted exactly as it is shown.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;Start Code&lt;/STRONG&gt;&lt;/P&gt; 
&lt;PRE&gt;// start part of your Java code
String json = ((String)globalMap.get("json"));
org.json.JSONObject jsonObj = new org.json.JSONObject(json);
org.json.JSONObject appMapObj = jsonObj.getJSONObject("applicationMap");
org.json.JSONObject taxesObj = appMapObj.getJSONObject("taxes");
java.util.Iterator&amp;lt;String&amp;gt; taxKeysIt = taxesObj.keys();

while(taxKeysIt.hasNext() ) {
	String taxKey = (String)taxKeysIt.next();
	
	org.json.JSONObject taxKeyObj = taxesObj.getJSONObject(taxKey);

	java.util.Iterator&amp;lt;String&amp;gt; innerKeysIt = taxKeyObj.keys();
	
	while(innerKeysIt.hasNext() ) {
		String innerKey = innerKeysIt.next();
		
		org.json.JSONArray innerArr = taxKeyObj.getJSONArray(innerKey);
		
		java.util.Iterator&amp;lt;Object&amp;gt; innerArrIt = innerArr.iterator();
		
		while(innerArrIt.hasNext()){      &lt;/PRE&gt; 
&lt;P&gt;&lt;STRONG&gt;Main Code&lt;/STRONG&gt;&lt;/P&gt; 
&lt;PRE&gt;			org.json.JSONObject innerObj = (org.json.JSONObject)innerArrIt.next();
			row2.taxes = taxKey;
			row2.innerTaxCode = innerKey;
			row2.amount = !innerObj.isNull("amount") ? innerObj.getDouble("amount") : 0;
			row2.initialAmount = !innerObj.isNull("initialAmount") ?  innerObj.getDouble("initialAmount") : 0;
			row2.description = !innerObj.isNull("description") ? innerObj.getString("description") : "";
			row2.taxItemId = !innerObj.isNull("taxItemId") ? innerObj.getInt("taxItemId") : 0;
			
			
			
&lt;/PRE&gt; 
&lt;P&gt;&lt;STRONG&gt;End Code&lt;/STRONG&gt;&lt;/P&gt; 
&lt;PRE&gt;// end of the component, outside/closing the loop
		}
	}
}&lt;/PRE&gt; 
&lt;P&gt;The tLogRow just prints out the results.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 13:38:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208557#M7727</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-13T13:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208558#M7728</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/005390000069RuGAAU"&gt;@rhall&lt;/A&gt;&amp;nbsp;. It really worked, and I was able to proceed with the rest of the transformations.&lt;BR /&gt;Thank you so much for your time! God bless you, man!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 13:23:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208558#M7728</guid>
      <dc:creator>jerownimow</dc:creator>
      <dc:date>2019-12-16T13:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208559#M7729</link>
      <description>&lt;P&gt;Glad I could help. You can return the favour by helping others as your experience grows &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 21:04:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2208559#M7729</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-16T21:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract values from Dynamic JSON fields?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2418642#M140155</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;this community thread has moved from&amp;nbsp;&lt;A href="https://community.talend.com/s/question/0D53p00007vClF4CAK/how-to-extract-values-from-dynamic-json-fields?language=en_US" target="_blank"&gt;https://community.talend.com/s/question/0D53p00007vClF4CAK/how-to-extract-values-from-dynamic-json-fields?language=en_US&lt;/A&gt;&amp;nbsp;but it seems that the attachment of the json file was not migrated properly, so that the whole solution cannot be comprehended any more.&lt;BR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/281118"&gt;@jerownimow&lt;/a&gt;&amp;nbsp;could you please reattach the file to this thread. Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2024 09:22:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-extract-values-from-Dynamic-JSON-fields/m-p/2418642#M140155</guid>
      <dc:creator>Andreas_B1</dc:creator>
      <dc:date>2024-02-14T09:22:18Z</dc:date>
    </item>
  </channel>
</rss>

