<?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: HELP PLEASE - Parsing JSON to flat file in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247766#M32846</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;I create the maximum list of possible productAttrs and use tFileInputJSON. If not, it returns NULL.&lt;/P&gt; 
&lt;P&gt;For ex. country not exist for current JSON and we have NULL, in other it will.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The main approach create full list of productAttr, if it's possible.(i think it is possible &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;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture_T.PNG" style="width: 444px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M2z4.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157958iB5F30A2319A0DDF1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M2z4.png" alt="0683p000009M2z4.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture_2.PNG" style="width: 578px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M2EF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128203i8A22BFEAE660B106/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M2EF.png" alt="0683p000009M2EF.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Thanks&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009Lukr"&gt;Capture_T.PNG&lt;/A&gt;</description>
    <pubDate>Thu, 07 Feb 2019 15:25:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-02-07T15:25:01Z</dc:date>
    <item>
      <title>HELP PLEASE - Parsing JSON to flat file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247761#M32841</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I have the following json file that I would like to parse out specific fields (in bold)&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;{ 
 "31265327613" : {
    "siteId" : "US",
    "entityTypeId" : 11111,
    "&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;productid&lt;/STRONG&gt;&lt;/FONT&gt;" : 31265327613,
    "quality" : -1.0,
    "productAttrs" : {
      "1" : {
        "attrTypeId" : 1,
        "&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;name&lt;/FONT&gt;&lt;/STRONG&gt;" : "&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;color&lt;/FONT&gt;&lt;/STRONG&gt;",
        "dataType" : "TEXT",
        "instock" : 1.0,
        "prodValues" : [ {
          "&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;value&lt;/FONT&gt;&lt;/STRONG&gt;" : "&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;blue&lt;/FONT&gt;&lt;/STRONG&gt;",
          "dimensions" : 2.0,
          "demand" : 1.0
        } ]
      },
      "2" : {
        "attrTypeId" : 2,
        "&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;name&lt;/STRONG&gt;&lt;/FONT&gt;" : "&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;band&lt;/STRONG&gt;&lt;/FONT&gt;",
        "dataType" : "TEXT",
        "instock" : 1.0,
        "prodValues" : [ {
          "&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;value&lt;/STRONG&gt;&lt;/FONT&gt;" : "&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;gsm&lt;/FONT&gt;&lt;/STRONG&gt;",
          "dimensions" : 2.0,
          "demand" : 1.0
        } ]
      },
      "3" : {
        "attrTypeId" : 3,
        "&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;name&lt;/STRONG&gt;&lt;/FONT&gt;" : "&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;productid&lt;/FONT&gt;&lt;/STRONG&gt;",
        "dataType" : "NUMERIC",
        "instock" : 1.0,
        "prodValues" : [ {
          "&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;value&lt;/FONT&gt;&lt;/STRONG&gt;" : "&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;31265327613&lt;/STRONG&gt;&lt;/FONT&gt;",
          "dimensions" : 2.0,
          "demand" : 3.0
        } ]
      }
    }
  }
}&lt;/PRE&gt; 
&lt;P&gt;I want the output to be a tab delimited text file with the following structure&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;productid&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp;color | band&lt;/P&gt; 
&lt;P&gt;31265327613 |&amp;nbsp;blue&amp;nbsp; |&amp;nbsp;gsm&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;few notes - the "names" can contain various names and (for the sake of the example I just provided 3.&lt;BR /&gt;each product can have different values for "names" (so please don't hard code the values in your reply)&lt;BR /&gt;&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;BR /&gt;I understand I need to go down the tree and iterate on the elements, extract what I need, exit and move to the next one. tried many ways with tFileInputJson and with tExtractJsonFields, but with no success.&lt;BR /&gt;I suspect I'm not using the correct syntax for the loop.&lt;BR /&gt;&lt;BR /&gt;thank you so much in advance, would appriciete if you could include screenshot of how you build the components with especially the tJSON ones.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 17:41:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247761#M32841</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-06T17:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: HELP PLEASE - Parsing JSON to flat file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247762#M32842</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;it possible, but of course not trivial.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;first of all need to know more information about file:&lt;/P&gt; 
&lt;UL&gt; 
 &lt;LI&gt;is it API responce for single id (&lt;PRE&gt;{ 
 "31265327613" : {&lt;/PRE&gt;or it is file with many of them, and you need first extract all id list?&lt;/LI&gt; 
 &lt;LI&gt;is it always only 3 attribute - "1", "2" and "3" or many of them? is numbers (tags) always the same or "1" could be and color and weight? &amp;nbsp;&lt;/LI&gt; 
 &lt;LI&gt;is prodValues array always contain only 1 element or many of them&lt;/LI&gt; 
&lt;/UL&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;depending on the answers - how will look structure in most worst case?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 11:42:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247762#M32842</guid>
      <dc:creator>vapukov</dc:creator>
      <dc:date>2019-02-07T11:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: HELP PLEASE - Parsing JSON to flat file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247763#M32843</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/005390000067LRbAAM"&gt;@vapukov&lt;/A&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;1. No, this is not a single response. I have a file full of the example above, a block for each productid. (for this post, I only uploaded block)&lt;BR /&gt;the productid is mentioned both in the root level, as well as one level below as you can see in my example.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt; 
&lt;P&gt;2. No, it is not always 3 attributes. for the purpose of the post I shortened the example to only 3.&lt;BR /&gt;The numbers tags are merely order sequence, I don't care about them, and don't need to extract them.&lt;BR /&gt;&lt;BR /&gt;3. No. it can have several value. for example color can have several values. see example:&lt;/P&gt; 
&lt;PRE&gt;      "1" : {
        "attrTypeId" : 1,
        "name" : "color",
        "dataType" : "TEXT",
        "instock" : 1.0,
        "prodValues" : [ {
          "value" : "black",
          "dimensions" : 2.0,
          "demand" : 1.0
        }, {
          "value" : "beige",
          "dimensions" : 2.0,
          "demand" : 1.0
        }, {
          "value" : "orange",
          "dimensions" : 2.0,
          "demand" : 1.0
        } ]&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Feb 2019 13:55:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247763#M32843</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-07T13:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: HELP PLEASE - Parsing JSON to flat file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247764#M32844</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sounds like you need to extract each attribute and value as a key/value pair and write them into a temporary table and using some kind of pivot, combine them all for a given product ID.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 15:03:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247764#M32844</guid>
      <dc:creator>David_Beaty</dc:creator>
      <dc:date>2019-02-07T15:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: HELP PLEASE - Parsing JSON to flat file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247765#M32845</link>
      <description>&lt;P&gt;Yes,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;extracting it as Name-Value Pairs will also help me &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;Like this:&lt;/P&gt; 
&lt;PRE&gt;31265327613 | Color | Blue
31265327613 | Color | Red
31265327613 | Color | Yellow&lt;/PRE&gt; 
&lt;P&gt;don't know how to do that &lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MPcz.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157233iD1A564EF62DE3BC2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MPcz.png" alt="0683p000009MPcz.png" /&gt;&lt;/span&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 15:18:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247765#M32845</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-07T15:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: HELP PLEASE - Parsing JSON to flat file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247766#M32846</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;I create the maximum list of possible productAttrs and use tFileInputJSON. If not, it returns NULL.&lt;/P&gt; 
&lt;P&gt;For ex. country not exist for current JSON and we have NULL, in other it will.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The main approach create full list of productAttr, if it's possible.(i think it is possible &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;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture_T.PNG" style="width: 444px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M2z4.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157958iB5F30A2319A0DDF1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M2z4.png" alt="0683p000009M2z4.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture_2.PNG" style="width: 578px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M2EF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128203i8A22BFEAE660B106/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M2EF.png" alt="0683p000009M2EF.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Thanks&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009Lukr"&gt;Capture_T.PNG&lt;/A&gt;</description>
      <pubDate>Thu, 07 Feb 2019 15:25:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/HELP-PLEASE-Parsing-JSON-to-flat-file/m-p/2247766#M32846</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-07T15:25:01Z</dc:date>
    </item>
  </channel>
</rss>

