<?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 What is the best way to modify fields in a complex JSON document? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/What-is-the-best-way-to-modify-fields-in-a-complex-JSON-document/m-p/2272039#M49432</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I'm trying to come up with a way to be able to make modifications to a "complex" JSON document using Talend.&amp;nbsp; However, I can't seem to get any one method working at all.&amp;nbsp; First, below is a sample JSON document to illustrate the structure:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;{
    "title": "foo",
    "team":
    [
        {
            "name": "Team 1",
            "collaborators":
            [
                {
                    "name": "Team 3"
                }
            ]
        },
        {
            "name": "Team 2",
            "collaborators":
            [
                {
                    "name": "Team 3"
                }
            ]
        }
    ]
}&lt;/PRE&gt; 
&lt;P&gt;FYI, we're using Talend Open Studio for Data Integration 7.0.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;To start, I wanted to find a way to modify the $.team.collaborators.name, such as converting the text to uppercase.&amp;nbsp; The main requirement of this flow is that the document needs to be written out in a similar structure as it came in as it's going to end up in a document store.&amp;nbsp; E.g. I can't break it out into rows.&amp;nbsp; So, regardless of any changes I make, it has to result in a single document.&amp;nbsp; The overall structure won't change much, except we may remove some unneeded fields.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I first tried to do this with the built-in JSON processors and came to the conclusion that they wouldn't work because everything I found made it look like the data would have to be flattened into a schema.&amp;nbsp; Next, I downloaded and installed the tJsonDoc processors and didn't have much more luck.&amp;nbsp; I could successfully open the document, but I couldn't extract a using tJsonDocExtraction, which may be deprecated as I don't see it on their Github page anymore.&amp;nbsp; Lastly, I tried to use tJavaRow and tJavaFlex to use Jackson directly to create the processor I require, but the closest I got was starting to use tJavaFlex and getting an error that it couldn't find ObjectMapper.&amp;nbsp; The funny thing here is that I was following what is in another post that supposedly worked.&amp;nbsp; I diverted slightly into creating a routine, but I couldn't import jackson even though I can see under the Modules view that it is installed.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;So, what is the cleanest/best way to do this?&lt;/P&gt;</description>
    <pubDate>Fri, 04 Jan 2019 19:15:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-01-04T19:15:11Z</dc:date>
    <item>
      <title>What is the best way to modify fields in a complex JSON document?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/What-is-the-best-way-to-modify-fields-in-a-complex-JSON-document/m-p/2272039#M49432</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I'm trying to come up with a way to be able to make modifications to a "complex" JSON document using Talend.&amp;nbsp; However, I can't seem to get any one method working at all.&amp;nbsp; First, below is a sample JSON document to illustrate the structure:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;{
    "title": "foo",
    "team":
    [
        {
            "name": "Team 1",
            "collaborators":
            [
                {
                    "name": "Team 3"
                }
            ]
        },
        {
            "name": "Team 2",
            "collaborators":
            [
                {
                    "name": "Team 3"
                }
            ]
        }
    ]
}&lt;/PRE&gt; 
&lt;P&gt;FYI, we're using Talend Open Studio for Data Integration 7.0.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;To start, I wanted to find a way to modify the $.team.collaborators.name, such as converting the text to uppercase.&amp;nbsp; The main requirement of this flow is that the document needs to be written out in a similar structure as it came in as it's going to end up in a document store.&amp;nbsp; E.g. I can't break it out into rows.&amp;nbsp; So, regardless of any changes I make, it has to result in a single document.&amp;nbsp; The overall structure won't change much, except we may remove some unneeded fields.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I first tried to do this with the built-in JSON processors and came to the conclusion that they wouldn't work because everything I found made it look like the data would have to be flattened into a schema.&amp;nbsp; Next, I downloaded and installed the tJsonDoc processors and didn't have much more luck.&amp;nbsp; I could successfully open the document, but I couldn't extract a using tJsonDocExtraction, which may be deprecated as I don't see it on their Github page anymore.&amp;nbsp; Lastly, I tried to use tJavaRow and tJavaFlex to use Jackson directly to create the processor I require, but the closest I got was starting to use tJavaFlex and getting an error that it couldn't find ObjectMapper.&amp;nbsp; The funny thing here is that I was following what is in another post that supposedly worked.&amp;nbsp; I diverted slightly into creating a routine, but I couldn't import jackson even though I can see under the Modules view that it is installed.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;So, what is the cleanest/best way to do this?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 19:15:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/What-is-the-best-way-to-modify-fields-in-a-complex-JSON-document/m-p/2272039#M49432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-04T19:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best way to modify fields in a complex JSON document?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/What-is-the-best-way-to-modify-fields-in-a-complex-JSON-document/m-p/2272040#M49433</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would suggest you tLibraryLoad "org.json.jar" and make the changes you need manually in something like a tJavaRow&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 11:20:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/What-is-the-best-way-to-modify-fields-in-a-complex-JSON-document/m-p/2272040#M49433</guid>
      <dc:creator>David_Beaty</dc:creator>
      <dc:date>2019-01-06T11:20:45Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best way to modify fields in a complex JSON document?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/What-is-the-best-way-to-modify-fields-in-a-complex-JSON-document/m-p/2272041#M49434</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, are you saying that there's no way to leverage the built-in Jackson library that comes with Talend?&amp;nbsp; It seems silly that one comes with the product, but we can't use it in a tJava_ component.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 14:27:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/What-is-the-best-way-to-modify-fields-in-a-complex-JSON-document/m-p/2272041#M49434</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-07T14:27:52Z</dc:date>
    </item>
  </channel>
</rss>

