<?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 format JSON Structure correctly? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-format-JSON-Structure-correctly/m-p/2217516#M13082</link>
    <description>hi,
&lt;BR /&gt;your expected json format do not match your data format.
&lt;BR /&gt;in your expected format lineno and itemGroupId are on the same column level but you did not want that.
&lt;BR /&gt;so there is 2 way modify your data to have 6 lines.
&lt;BR /&gt;or manual build your json using document type to store Json data.
&lt;BR /&gt;
&lt;BR /&gt;</description>
    <pubDate>Mon, 16 Dec 2019 16:09:19 GMT</pubDate>
    <dc:creator>fdenis</dc:creator>
    <dc:date>2019-12-16T16:09:19Z</dc:date>
    <item>
      <title>How to format JSON Structure correctly?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-format-JSON-Structure-correctly/m-p/2217515#M13081</link>
      <description>&lt;P&gt;Hi Folks,&lt;BR /&gt;&lt;BR /&gt;Requesting your assistance on this JSON Problem. I have a job which extracts JSON from a Table.&lt;BR /&gt;&lt;STRONG&gt;Flow:&lt;BR /&gt;Process-&amp;gt;tWriteJSONField-&amp;gt;out&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;Here's a sample input:&lt;BR /&gt;&lt;/P&gt; 
&lt;TABLE width="581"&gt; 
 &lt;TBODY&gt; 
  &lt;TR&gt; 
   &lt;TD width="64"&gt;invoiceId&lt;/TD&gt; 
   &lt;TD width="64"&gt;lineNo&lt;/TD&gt; 
   &lt;TD width="81"&gt;licenseId&lt;/TD&gt; 
   &lt;TD width="122"&gt;itemGroupId&lt;/TD&gt; 
   &lt;TD width="122"&gt;Step4_itemGroupId&lt;/TD&gt; 
   &lt;TD width="64"&gt;maxRefundAmount&lt;/TD&gt; 
   &lt;TD width="64"&gt;taxItemId&lt;/TD&gt; 
  &lt;/TR&gt; 
  &lt;TR&gt; 
   &lt;TD&gt;785001&lt;/TD&gt; 
   &lt;TD&gt;13&lt;/TD&gt; 
   &lt;TD&gt;28638001&lt;/TD&gt; 
   &lt;TD&gt;708170001&lt;/TD&gt; 
   &lt;TD&gt;708170001&lt;/TD&gt; 
   &lt;TD&gt;1.00&lt;/TD&gt; 
   &lt;TD&gt;4880001&lt;/TD&gt; 
  &lt;/TR&gt; 
  &lt;TR&gt; 
   &lt;TD&gt;785001&lt;/TD&gt; 
   &lt;TD&gt;13&lt;/TD&gt; 
   &lt;TD&gt;28638001&lt;/TD&gt; 
   &lt;TD&gt;708170001&lt;/TD&gt; 
   &lt;TD&gt;708170001&lt;/TD&gt; 
   &lt;TD&gt;1.00&lt;/TD&gt; 
   &lt;TD&gt;4883001&lt;/TD&gt; 
  &lt;/TR&gt; 
  &lt;TR&gt; 
   &lt;TD&gt;785001&lt;/TD&gt; 
   &lt;TD&gt;8&lt;/TD&gt; 
   &lt;TD&gt;28637001&lt;/TD&gt; 
   &lt;TD&gt;708169001&lt;/TD&gt; 
   &lt;TD&gt;708169001&lt;/TD&gt; 
   &lt;TD&gt;4.00&lt;/TD&gt; 
   &lt;TD&gt;4880001&lt;/TD&gt; 
  &lt;/TR&gt; 
  &lt;TR&gt; 
   &lt;TD&gt;785001&lt;/TD&gt; 
   &lt;TD&gt;8&lt;/TD&gt; 
   &lt;TD&gt;28637001&lt;/TD&gt; 
   &lt;TD&gt;708169001&lt;/TD&gt; 
   &lt;TD&gt;708169001&lt;/TD&gt; 
   &lt;TD&gt;4.00&lt;/TD&gt; 
   &lt;TD&gt;4883001&lt;/TD&gt; 
  &lt;/TR&gt; 
 &lt;/TBODY&gt; 
&lt;/TABLE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Expected Output:&lt;/P&gt; 
&lt;PRE&gt;{
	"body": {
		"invoices": [
			{
				"invoiceId": "785001",
				"items": [
					{
						"lineNo": "13",
						"licenseId": "28638001",
						"itemGroupId": "708170001"
					},
					{
						"itemGroupId": 708170001,
						"maxRefundAmount": 1.00,
						"taxItemId": 4880001
					},
					{
						"itemGroupId": 708170001,
						"maxRefundAmount": 1.00,
						"taxItemId": 4883001						
					},
					{
						"lineNo": "8",
						"licenseId": "28637001",
						"itemGroupId": "708169001"
					},
					{
						"itemGroupId": 708169001,
						"maxRefundAmount": 4.00,
						"taxItemId": 4880001						
					},
					{
						"itemGroupId": 708169001,
						"maxRefundAmount": 4.00,
						"taxItemId": 4883001
					}
				]
			}
		]
	}
}&lt;/PRE&gt; 
&lt;P&gt;Right now, I can only achieve this:&lt;/P&gt; 
&lt;PRE&gt;{
	"body": {
		"invoices": [
			{
				"invoiceId": "785001",
				"items": [
					{
						"lineNo": "13",
						"licenseId": "28638001",
						"itemGroupId": "708170001",
						"response": [
							{
								"itemGroupId": null,
								"maxRefundAmount": null
							},
							{
								"itemGroupId": null,
								"maxRefundAmount": null
							}
						]
					},
					{
						"lineNo": "8",
						"licenseId": "28637001",
						"itemGroupId": "708169001",
						"response": [
							{
								"itemGroupId": null,
								"maxRefundAmount": null
							},
							{
								"itemGroupId": null,
								"maxRefundAmount": null
							}
						]
					}
				]
			}
		]
	}
}&lt;/PRE&gt; 
&lt;P&gt;With this configuration on tExtractJSONFields:&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JSONstructure.PNG" style="width: 646px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8Mb.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/141425i1A17AB76B12C8BE3/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8Mb.png" alt="0683p000009M8Mb.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:49:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-format-JSON-Structure-correctly/m-p/2217515#M13081</guid>
      <dc:creator>jerownimow</dc:creator>
      <dc:date>2024-11-16T03:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to format JSON Structure correctly?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-format-JSON-Structure-correctly/m-p/2217516#M13082</link>
      <description>hi,
&lt;BR /&gt;your expected json format do not match your data format.
&lt;BR /&gt;in your expected format lineno and itemGroupId are on the same column level but you did not want that.
&lt;BR /&gt;so there is 2 way modify your data to have 6 lines.
&lt;BR /&gt;or manual build your json using document type to store Json data.
&lt;BR /&gt;
&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:09:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-format-JSON-Structure-correctly/m-p/2217516#M13082</guid>
      <dc:creator>fdenis</dc:creator>
      <dc:date>2019-12-16T16:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to format JSON Structure correctly?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-format-JSON-Structure-correctly/m-p/2217517#M13083</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/0053p000007LKpMAAW"&gt;@fdenis&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your feedback. Yes they should be on the same column level, and the other ItemGroupId is separate as they were from different source fields.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 00:51:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-format-JSON-Structure-correctly/m-p/2217517#M13083</guid>
      <dc:creator>jerownimow</dc:creator>
      <dc:date>2019-12-17T00:51:15Z</dc:date>
    </item>
  </channel>
</rss>

