<?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: Create complex json with tWriteJSONField in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343261#M111036</link>
    <description>&lt;P&gt;I am using the free edition.&lt;/P&gt;&lt;P&gt;Can you explain me how to use several tWriteJSONField components ?&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jan 2023 13:57:34 GMT</pubDate>
    <dc:creator>MCANTAL1639145723</dc:creator>
    <dc:date>2023-01-23T13:57:34Z</dc:date>
    <item>
      <title>Create complex json with tWriteJSONField</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343259#M111034</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have to create a json object whose format is attached. I can map. &lt;/P&gt;&lt;P&gt;I will use tmap to map the data and then I have to use a twritejsonfield component. How should i configure this component ?&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000cefM5AAI.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138953iFEF8B7A66E8A5892/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000cefM5AAI.jpg" alt="0695b00000cefM5AAI.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2023 21:43:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343259#M111034</guid>
      <dc:creator>MCANTAL1639145723</dc:creator>
      <dc:date>2023-01-21T21:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create complex json with tWriteJSONField</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343260#M111035</link>
      <description>&lt;P&gt;This is going to require a little more than a single tWriteJSONField component. Are you using Talend Open Studio (the free edition) or the Enterprise edition? If you are using the Enterprise edition, you would probably be better off doing this with the Data Mapper. If you are using Talend Open Studio, you will either need to use several tWriteJSONField components (with a bit of String manipulation) or build this with a bit of Java. To be honest, I would go with building this with a bit of Java if I were using Talend Open Studio for this. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 11:18:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343260#M111035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-23T11:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create complex json with tWriteJSONField</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343261#M111036</link>
      <description>&lt;P&gt;I am using the free edition.&lt;/P&gt;&lt;P&gt;Can you explain me how to use several tWriteJSONField components ?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 13:57:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343261#M111036</guid>
      <dc:creator>MCANTAL1639145723</dc:creator>
      <dc:date>2023-01-23T13:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create complex json with tWriteJSONField</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343262#M111037</link>
      <description>&lt;P&gt;OK, here is a very basic example. I am using what I have seen from your JSON to demonstrate an inner loop. You can only really effectively handle one loop at a time per component. So I am writing the "countries" loop. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a simple job. The tFixedFlowInput has some of the data you shared. The tWriteJSONField component will build the "countries" loop. The tLogRow will display it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000cejh7AAA.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/152115i141FE4EB5A93EDAE/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000cejh7AAA.png" alt="0695b00000cejh7AAA.png" /&gt;&lt;/span&gt;As you can see, I have included only a small section of the data....&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000ceji0AAA.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/156777i2E46330B2FA46005/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000ceji0AAA.png" alt="0695b00000ceji0AAA.png" /&gt;&lt;/span&gt;This is how I have mapped the data to the JSON structure that I have built. Notice the 2 countries elements. The first one will give the element name in the output. The second one just drives the loop.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000cejieAAA.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/144421iED123EBFA4DB0A01/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000cejieAAA.png" alt="0695b00000cejieAAA.png" /&gt;&lt;/span&gt;Notice the grouping here. I am grouping the output JSON by the languageCode. It will produce a different section of JSON per languageCode. Since I am supply two languageCodes (en and fr), you will see two JSON Strings produced.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000cejjDAAQ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146675i6EECFF131583444E/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000cejjDAAQ.png" alt="0695b00000cejjDAAQ.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the JSON that is produced....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{"languages":{"languageCode":"en","colour":"rouge","details":{"product":{"countries":[{"step":"Step 1","countryCode":"CHN"},{"step":"Step 2","countryCode":"FRA"},{"step":"Step 3","countryCode":"DEU"}]}}}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{"languages":{"languageCode":"fr","colour":"rouge","details":{"product":{"countries":[{"step":"Step 1","countryCode":"CHN"},{"step":"Step 2","countryCode":"FRA"},{"step":"Step 3","countryCode":"DEU"}]}}}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you have this, you will need to consider this another "column" of data when you are building the outer loop in the same way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I said, this can be fiddly. I generally prefer to spend a bit of time using Java to do this. It can take a while to perfect, but once it is done, it is easily reusable and very logical to read.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 14:56:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343262#M111037</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-23T14:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create complex json with tWriteJSONField</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343263#M111038</link>
      <description>&lt;P&gt;Thanks it will help me a lot.&lt;/P&gt;&lt;P&gt; You write "you will need to consider this another "column" of data when you are building the outer loop in the same way." but how to link this new column with the data of the outer loop ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 21:22:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343263#M111038</guid>
      <dc:creator>MCANTAL1639145723</dc:creator>
      <dc:date>2023-01-23T21:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create complex json with tWriteJSONField</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343264#M111039</link>
      <description>&lt;P&gt;This is not obvious, but it is quite simple. Pass the key data column through with the other data. Instead of using it in your JSON, create an extra output column (along with your JSON output column) and add it to the Group By. Then you JSON will be passed through along with our key column.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 11:58:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343264#M111039</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-24T11:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create complex json with tWriteJSONField</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343265#M111040</link>
      <description>&lt;P&gt;I'm not sure I understand evrything, can you give me an example?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 17:04:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343265#M111040</guid>
      <dc:creator>MCANTAL1639145723</dc:creator>
      <dc:date>2023-01-24T17:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create complex json with tWriteJSONField</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343266#M111041</link>
      <description>&lt;P&gt;I have extended the example I gave above to show this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the tFixedFlowInput....where my data comes from. See I have added a "key" field. I have added the values "bob" and "bob3".....just random values that came to me.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000cf5YgAAI.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/147334i1AEF52362970A104/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000cf5YgAAI.png" alt="0695b00000cf5YgAAI.png" /&gt;&lt;/span&gt;Now see that I have added this column to the grouping of the tWriteJSONField component. I also added the "key" column to be an output column from this component.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000cf5ZKAAY.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154609iCC812529D89CA283/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000cf5ZKAAY.png" alt="0695b00000cf5ZKAAY.png" /&gt;&lt;/span&gt;When I now run this, I get the following....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{"languages":{"languageCode":"en","colour":"rouge","details":{"product":{"countries":[{"step":"Step 1","countryCode":"CHN"},{"step":"Step 2","countryCode":"FRA"},{"step":"Step 3","countryCode":"DEU"}]}}}}|Bob&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{"languages":{"languageCode":"fr","colour":"rouge","details":{"product":{"countries":[{"step":"Step 1","countryCode":"CHN"},{"step":"Step 2","countryCode":"FRA"},{"step":"Step 3","countryCode":"DEU"}]}}}}|Bob3&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 17:46:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343266#M111041</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-24T17:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create complex json with tWriteJSONField</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343267#M111042</link>
      <description>&lt;P&gt;Thanks, it's working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How not to write fields with null values ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0695b00000cflG0AAI.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146301i445269D9FC14E550/image-size/large?v=v2&amp;amp;px=999" role="button" title="0695b00000cflG0AAI.png" alt="0695b00000cflG0AAI.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 12:13:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Create-complex-json-with-tWriteJSONField/m-p/2343267#M111042</guid>
      <dc:creator>MCANTAL1639145723</dc:creator>
      <dc:date>2023-01-27T12:13:13Z</dc:date>
    </item>
  </channel>
</rss>

