<?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 Convert relational data to JSON in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Convert-relational-data-to-JSON/m-p/2251642#M35533</link>
    <description>Hi, 
&lt;BR /&gt;I have the basics of this nailed down but there are things I can't get my head around. 
&lt;BR /&gt;We need to convert some relational data into json format for sending to an API as an HTTP POST request.&amp;nbsp; 
&lt;BR /&gt; 
&lt;U&gt;Example source data (CSV)&lt;/U&gt; 
&lt;BR /&gt; 
&lt;PRE&gt;COUNTRY,FILM,STAR_RATING,FILM_PAGE_URL&lt;BR /&gt;UK,FILM 1,3,http://test.co.uk&lt;BR /&gt;AU,FILM 2,4,http://test.com.au&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;U&gt;Required output&amp;nbsp;&lt;/U&gt; 
&lt;BR /&gt;Here there are multiple films in one payload. This example just has two. 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;PRE&gt;&lt;/PRE&gt; 
&lt;BR /&gt;&amp;nbsp;&amp;nbsp; 
&lt;BR /&gt;So far we have the following components (I have replaced the tRest component that will ultimately be used with a file output to troubleshoot the end JSON). 
&lt;BR /&gt;In the tWriteJSON component we have the following tree set up 
&lt;BR /&gt;And the output schema is just set to "String" 
&lt;BR /&gt;This is mostly working but the end file looks like below. I can't work out how to get rid of the repeating attribute names "string" and the root "data". Maybe this isn't possible or I just need to do a find and replace to take these out? 
&lt;BR /&gt;I also don't want all the escape characters "\" that seem to have been inserted. The tRest component only requires the " to be escaped. 
&lt;BR /&gt; 
&lt;PRE&gt;{ &amp;nbsp;&lt;BR /&gt; &amp;nbsp; &amp;nbsp;"data":&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;I would appreciated any input to solve these formatting issues, or indeed some guidance on better best practice for this kind of scenario. 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;b/</description>
    <pubDate>Wed, 09 Dec 2015 16:34:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-12-09T16:34:26Z</dc:date>
    <item>
      <title>Convert relational data to JSON</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Convert-relational-data-to-JSON/m-p/2251642#M35533</link>
      <description>Hi, 
&lt;BR /&gt;I have the basics of this nailed down but there are things I can't get my head around. 
&lt;BR /&gt;We need to convert some relational data into json format for sending to an API as an HTTP POST request.&amp;nbsp; 
&lt;BR /&gt; 
&lt;U&gt;Example source data (CSV)&lt;/U&gt; 
&lt;BR /&gt; 
&lt;PRE&gt;COUNTRY,FILM,STAR_RATING,FILM_PAGE_URL&lt;BR /&gt;UK,FILM 1,3,http://test.co.uk&lt;BR /&gt;AU,FILM 2,4,http://test.com.au&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;U&gt;Required output&amp;nbsp;&lt;/U&gt; 
&lt;BR /&gt;Here there are multiple films in one payload. This example just has two. 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;PRE&gt;&lt;/PRE&gt; 
&lt;BR /&gt;&amp;nbsp;&amp;nbsp; 
&lt;BR /&gt;So far we have the following components (I have replaced the tRest component that will ultimately be used with a file output to troubleshoot the end JSON). 
&lt;BR /&gt;In the tWriteJSON component we have the following tree set up 
&lt;BR /&gt;And the output schema is just set to "String" 
&lt;BR /&gt;This is mostly working but the end file looks like below. I can't work out how to get rid of the repeating attribute names "string" and the root "data". Maybe this isn't possible or I just need to do a find and replace to take these out? 
&lt;BR /&gt;I also don't want all the escape characters "\" that seem to have been inserted. The tRest component only requires the " to be escaped. 
&lt;BR /&gt; 
&lt;PRE&gt;{ &amp;nbsp;&lt;BR /&gt; &amp;nbsp; &amp;nbsp;"data":&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;I would appreciated any input to solve these formatting issues, or indeed some guidance on better best practice for this kind of scenario. 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;b/</description>
      <pubDate>Wed, 09 Dec 2015 16:34:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Convert-relational-data-to-JSON/m-p/2251642#M35533</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-09T16:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert relational data to JSON</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Convert-relational-data-to-JSON/m-p/2251643#M35534</link>
      <description>Hi Bisquite, 
&lt;BR /&gt;Can you share the screen shot of the mapping and how you are grouping multiple rows into JSON array ? 
&lt;BR /&gt;I tried this and it worked fine but, outtput is a json/row. 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MCbu.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157254iE67999D92B14B82E/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MCbu.png" alt="0683p000009MCbu.png" /&gt;&lt;/span&gt;There is a option in tReadJsonFields basic settings&amp;nbsp;to exclude rootTag.</description>
      <pubDate>Sat, 12 Dec 2015 12:27:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Convert-relational-data-to-JSON/m-p/2251643#M35534</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-12T12:27:02Z</dc:date>
    </item>
  </channel>
</rss>

