<?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 How to build the correct format of JSON structure in tWriteJSON field in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250887#M35010</link>
    <description>&lt;P&gt;I have this issue on tWriteJSONField wherein it generates an incomplete structure, maybe on my settings, can't find it! &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;BR /&gt;Now I have this source data and conversion to JSON:&lt;/P&gt; 
&lt;PRE&gt;&lt;STRONG&gt;Scenario 1:&lt;/STRONG&gt;
.-----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+--------.
|                                                                                                 tLogRow_3                                                 |
|=----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+-------=|
|userId     |ExpenseId		 |ExpenseItemId|refundAmount|totalExpense  |approverFirstName|approverLastName|userFirstName|userLastName|sessionId|lastPage|
|=----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+-------=|
|123456789  |978654              |100643927004 |192.43      |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
|123456789  |978654              |100643928004 |9.62        |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
'-----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+--------'

&lt;STRONG&gt;Scenario 1- tWriteJSONField Result:&lt;/STRONG&gt;

{
    "AllExpenses": {
        "Expenses": {
            "userId": "123456789",
            "totalExpense": "0",
            "UserInfo": {
                "userLastName": "Azerabas",
                "userFirstName": "Majik",
                "approverLastName": "Gossiengfao",
                "approverFirstName": "Meke",
            },
            "ExpenseId": "978654",
            "ExpenseItems": [
                {
                    "refundAmount": "192.43",
                    "ExpenseItemId": "100643927004"
                },
                {
                    "refundAmount": "9.62",
                    "ExpenseItemId": "100643928004"
                }
			]
		}
    }
}

&lt;STRONG&gt;Scenario 2:&lt;/STRONG&gt;
.-----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+--------.
|                                                                                                 tLogRow_3                                                 |
|=----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+-------=|
|userId     |ExpenseId		 |ExpenseItemId|refundAmount|totalExpense  |approverFirstName|approverLastName|userFirstName|userLastName|sessionId|lastPage|
|=----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+-------=|
|123456789  |978654              |100643927004 |192.43      |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
|123456789  |978654              |100643928004 |9.62        |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
|123456789  |542367              |990387800041 |2.7         |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
|123456789  |542367              |990387810043 |1.32        |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
'-----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+--------'
&lt;BR /&gt;&lt;STRONG&gt;Scenario 2- tWriteJSONField Result:&lt;/STRONG&gt; 
{
	"AllExpenses": [
		{
			"userId": "123456789",
			"totalExpense": "0",
			"UserInfo": {
				"userLastName": "Azerabas",
				"userFirstName": "Majik",
				"approverLastName": "Gossiengfao",
				"approverFirstName": "Meke",
			},
			"ExpenseId": "978654",
			"ExpenseItems": [
                {
                    "refundAmount": "192.43",
                    "ExpenseItemId": "100643927004"
                },
                {
                    "refundAmount": "9.62",
                    "ExpenseItemId": "100643928004"
                }
			]
		},
		{
			"userId": "123456789",
			"totalExpense": "0",
			"UserInfo": {
				"userLastName": "Azerabas",
				"userFirstName": "Majik",
				"approverLastName": "Gossiengfao",
				"approverFirstName": "Meke",
			},
			"ExpenseId": "542367",
			"ExpenseItems": [
				{
					"refundAmount": "2.7",
					"ExpenseItemId": "990387800041"
				},
				{
					"refundAmount": "1.32",
					"ExpenseItemId": "990387810043"
				}
			]
		}
	]
}&lt;/PRE&gt; 
&lt;P&gt;**For scenario 1 the JSON format is correct, but for scenario 2 the JSON format is a little bit wrong. What's lacking on 2nd scenario JSON output is the group&amp;nbsp; &lt;STRONG&gt;"Expenses": {&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The component is configured as follow:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JSON structure.PNG" style="width: 349px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8VF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/144891i70D0579D73831F80/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8VF.png" alt="0683p000009M8VF.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Now it only caters perfectly to the 1st scenario, but the 2nd scenario has a missing parent node as mentioned. Can you please suggest what's the best set-up to facilitate both requests?&lt;BR /&gt;&lt;BR /&gt;Let me know if you need more info. Thank you so much.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Nov 2019 13:04:29 GMT</pubDate>
    <dc:creator>jerownimow</dc:creator>
    <dc:date>2019-11-12T13:04:29Z</dc:date>
    <item>
      <title>How to build the correct format of JSON structure in tWriteJSON field</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250887#M35010</link>
      <description>&lt;P&gt;I have this issue on tWriteJSONField wherein it generates an incomplete structure, maybe on my settings, can't find it! &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;BR /&gt;Now I have this source data and conversion to JSON:&lt;/P&gt; 
&lt;PRE&gt;&lt;STRONG&gt;Scenario 1:&lt;/STRONG&gt;
.-----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+--------.
|                                                                                                 tLogRow_3                                                 |
|=----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+-------=|
|userId     |ExpenseId		 |ExpenseItemId|refundAmount|totalExpense  |approverFirstName|approverLastName|userFirstName|userLastName|sessionId|lastPage|
|=----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+-------=|
|123456789  |978654              |100643927004 |192.43      |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
|123456789  |978654              |100643928004 |9.62        |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
'-----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+--------'

&lt;STRONG&gt;Scenario 1- tWriteJSONField Result:&lt;/STRONG&gt;

{
    "AllExpenses": {
        "Expenses": {
            "userId": "123456789",
            "totalExpense": "0",
            "UserInfo": {
                "userLastName": "Azerabas",
                "userFirstName": "Majik",
                "approverLastName": "Gossiengfao",
                "approverFirstName": "Meke",
            },
            "ExpenseId": "978654",
            "ExpenseItems": [
                {
                    "refundAmount": "192.43",
                    "ExpenseItemId": "100643927004"
                },
                {
                    "refundAmount": "9.62",
                    "ExpenseItemId": "100643928004"
                }
			]
		}
    }
}

&lt;STRONG&gt;Scenario 2:&lt;/STRONG&gt;
.-----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+--------.
|                                                                                                 tLogRow_3                                                 |
|=----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+-------=|
|userId     |ExpenseId		 |ExpenseItemId|refundAmount|totalExpense  |approverFirstName|approverLastName|userFirstName|userLastName|sessionId|lastPage|
|=----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+-------=|
|123456789  |978654              |100643927004 |192.43      |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
|123456789  |978654              |100643928004 |9.62        |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
|123456789  |542367              |990387800041 |2.7         |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
|123456789  |542367              |990387810043 |1.32        |0             |Meke             |Gossiengfao     |Majik        |Azerabas    |12345    |true    |
'-----------+--------------------+-------------+------------+--------------+-----------------+----------------+-------------+------------+---------+--------'
&lt;BR /&gt;&lt;STRONG&gt;Scenario 2- tWriteJSONField Result:&lt;/STRONG&gt; 
{
	"AllExpenses": [
		{
			"userId": "123456789",
			"totalExpense": "0",
			"UserInfo": {
				"userLastName": "Azerabas",
				"userFirstName": "Majik",
				"approverLastName": "Gossiengfao",
				"approverFirstName": "Meke",
			},
			"ExpenseId": "978654",
			"ExpenseItems": [
                {
                    "refundAmount": "192.43",
                    "ExpenseItemId": "100643927004"
                },
                {
                    "refundAmount": "9.62",
                    "ExpenseItemId": "100643928004"
                }
			]
		},
		{
			"userId": "123456789",
			"totalExpense": "0",
			"UserInfo": {
				"userLastName": "Azerabas",
				"userFirstName": "Majik",
				"approverLastName": "Gossiengfao",
				"approverFirstName": "Meke",
			},
			"ExpenseId": "542367",
			"ExpenseItems": [
				{
					"refundAmount": "2.7",
					"ExpenseItemId": "990387800041"
				},
				{
					"refundAmount": "1.32",
					"ExpenseItemId": "990387810043"
				}
			]
		}
	]
}&lt;/PRE&gt; 
&lt;P&gt;**For scenario 1 the JSON format is correct, but for scenario 2 the JSON format is a little bit wrong. What's lacking on 2nd scenario JSON output is the group&amp;nbsp; &lt;STRONG&gt;"Expenses": {&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The component is configured as follow:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JSON structure.PNG" style="width: 349px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8VF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/144891i70D0579D73831F80/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8VF.png" alt="0683p000009M8VF.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Now it only caters perfectly to the 1st scenario, but the 2nd scenario has a missing parent node as mentioned. Can you please suggest what's the best set-up to facilitate both requests?&lt;BR /&gt;&lt;BR /&gt;Let me know if you need more info. Thank you so much.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 13:04:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250887#M35010</guid>
      <dc:creator>jerownimow</dc:creator>
      <dc:date>2019-11-12T13:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to build the correct format of JSON structure in tWriteJSON field</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250888#M35011</link>
      <description>&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/0053p000007LOmLAAW"&gt;@jerome29&lt;/A&gt;&amp;nbsp;, if you have Talend licensed version ,you can use Talend Data Mapper,it would be much easier to handle hierarchical format file. check the below links to know about talend&amp;nbsp; &amp;nbsp;data mapper.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://community.qlik.com/s/article/ka03p0000006EwJAAU" target="_blank"&gt;https://community.talend.com/t5/Design-and-Development/Talend-Data-Mapper-Intro-Part-1-What-is-the-Data-Mapper/ta-p/38545&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://community.qlik.com/s/article/ka03p0000006EwKAAU" target="_blank"&gt;https://community.talend.com/t5/Design-and-Development/Talend-Data-Mapper-Intro-Part-2-Using-the-Data-Mapper/ta-p/38546&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 13:23:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250888#M35011</guid>
      <dc:creator>manodwhb</dc:creator>
      <dc:date>2019-11-12T13:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to build the correct format of JSON structure in tWriteJSON field</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250889#M35012</link>
      <description>The tWriteJsonField component seems a little lacking on features while working with complex json objects. I have tried using a custom Talend Component "tJSONDoc" (
&lt;A href="https://github.com/jlolling/talendcomp_tJSONDoc" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/jlolling/talendcomp_tJSONDoc&lt;/A&gt;)
&lt;BR /&gt;
&lt;BR /&gt;The documentation can be a little confusing in the beginning.
&lt;BR /&gt;HTH
&lt;BR /&gt;
&lt;BR /&gt;PS: I am still learning this component, and so far, I have had multiple success overall using this component in creating complex objects.</description>
      <pubDate>Tue, 19 Nov 2019 22:01:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250889#M35012</guid>
      <dc:creator>root</dc:creator>
      <dc:date>2019-11-19T22:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to build the correct format of JSON structure in tWriteJSON field</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250890#M35013</link>
      <description>Hi plumberg 
&lt;BR /&gt;If you have any question about tJSONDoc component, you can contact the author (jlolling) of the tJSONDoc component, I think jlolling is happy to help you, he is one of the top contributors on our community. 
&lt;BR /&gt; 
&lt;BR /&gt;Regards 
&lt;BR /&gt;Shong</description>
      <pubDate>Wed, 20 Nov 2019 02:39:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250890#M35013</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-11-20T02:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to build the correct format of JSON structure in tWriteJSON field</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250891#M35014</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LLsfAAG"&gt;@mbocquet&lt;/A&gt;&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LKmJAAW"&gt;@manodwhb&lt;/A&gt;&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/00539000004XsnJAAS"&gt;@shong&lt;/A&gt;&amp;nbsp; for all your responses. Appreciate it, I haven't tried the tJSONDoc, maybe next time.&lt;BR /&gt;&lt;BR /&gt;What I did was to handle it via attributes and static values then I got the desired output.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 10:50:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-build-the-correct-format-of-JSON-structure-in-tWriteJSON/m-p/2250891#M35014</guid>
      <dc:creator>jerownimow</dc:creator>
      <dc:date>2019-12-03T10:50:40Z</dc:date>
    </item>
  </channel>
</rss>

