<?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>question Re: Add json object in the json content of flowfile in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Add-json-object-in-the-json-content-of-flowfile/m-p/238035#M199846</link>
    <description>&lt;P&gt;You can use UpdateRecord for this, but make sure you have the additional fields in your writer's schema. Alternatively you can use JoltTransformJSON with the following spec:&lt;/P&gt;&lt;PRE&gt;[
&amp;nbsp; {
&amp;nbsp; &amp;nbsp; "operation": "default",
&amp;nbsp; &amp;nbsp; "spec": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; "attributes": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "id": "12233",
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "map": "Y"
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; }
]
&lt;/PRE&gt;</description>
    <pubDate>Tue, 09 Apr 2019 21:54:02 GMT</pubDate>
    <dc:creator>mburgess</dc:creator>
    <dc:date>2019-04-09T21:54:02Z</dc:date>
    <item>
      <title>Add json object in the json content of flowfile</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Add-json-object-in-the-json-content-of-flowfile/m-p/238034#M199845</link>
      <description>&lt;P&gt;I have a json flowfile with below content&lt;/P&gt;&lt;P&gt;{&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;"name":"abc"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;I want the output should be &lt;/P&gt;&lt;P&gt;{&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;"name":"abc",&lt;/P&gt;&lt;P&gt;"attributes":{&lt;!-- --&gt;&lt;/P&gt;&lt;P&gt;"id":"12233",&lt;/P&gt;&lt;P&gt;"map":"Y"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;How to achieve the same?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 21:45:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Add-json-object-in-the-json-content-of-flowfile/m-p/238034#M199845</guid>
      <dc:creator>sakina_shaikh</dc:creator>
      <dc:date>2019-04-09T21:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Add json object in the json content of flowfile</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Add-json-object-in-the-json-content-of-flowfile/m-p/238035#M199846</link>
      <description>&lt;P&gt;You can use UpdateRecord for this, but make sure you have the additional fields in your writer's schema. Alternatively you can use JoltTransformJSON with the following spec:&lt;/P&gt;&lt;PRE&gt;[
&amp;nbsp; {
&amp;nbsp; &amp;nbsp; "operation": "default",
&amp;nbsp; &amp;nbsp; "spec": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; "attributes": {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "id": "12233",
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "map": "Y"
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; }
]
&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Apr 2019 21:54:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Add-json-object-in-the-json-content-of-flowfile/m-p/238035#M199846</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2019-04-09T21:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Add json object in the json content of flowfile</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Add-json-object-in-the-json-content-of-flowfile/m-p/238036#M199847</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; do you mind helping me out with a similar issue?&lt;/P&gt;&lt;P&gt;I have a json file comming in as :&lt;/P&gt;&lt;PRE&gt;[ {
&amp;nbsp; "regId" : "us",
&amp;nbsp; "cId" : "SomeProduct",
&amp;nbsp; "weId" : 15,
&amp;nbsp; "name" : "R",
&amp;nbsp; "id" : 1539,
&amp;nbsp; "cityId" : 17,
&amp;nbsp; "cityName" : "Moskow"
}, {
&amp;nbsp; "regId" : "us",
&amp;nbsp; "cId" : "SomeProduct",
&amp;nbsp; "weId" : 15,
&amp;nbsp; "name" : "R",
&amp;nbsp; "id" : 1540,
&amp;nbsp; "cityId" : 18,
&amp;nbsp; "cityName" : "Berlin"
}, {
&amp;nbsp; "regId" : "us",
&amp;nbsp; "cId" : "SomeProduct",
&amp;nbsp; "weId" : 15,
&amp;nbsp; "name" : "R",
&amp;nbsp; "id" : 1541,
&amp;nbsp; "cityId" : 19,
&amp;nbsp; "cityName" : "Vienna"
} ]&lt;/PRE&gt;&lt;P&gt;I need to add 3 new fields passed from the FlowFile attribute into each element? Can I do that with the update Record also?&lt;/P&gt;&lt;PRE&gt;[ {
&amp;nbsp; "new_att":"somevalue",
&amp;nbsp; "new_att2":"somevalue2",
&amp;nbsp; "new_att3":"somevalue3",
&amp;nbsp; "regId" : "us",
&amp;nbsp; "cId" : "SomeProduct",
&amp;nbsp; "weId" : 15,
&amp;nbsp; "name" : "R",
&amp;nbsp; "id" : 1539,
&amp;nbsp; "cityId" : 17,
&amp;nbsp; "cityName" : "Moskow"
}, {
&amp;nbsp; "new_att":"somevalue",
&amp;nbsp; "new_att2":"somevalue2",
&amp;nbsp; "new_att3":"somevalue3",
&amp;nbsp; "regId" : "us",
&amp;nbsp; "cId" : "SomeProduct",
&amp;nbsp; "weId" : 15,
&amp;nbsp; "name" : "R",
&amp;nbsp; "id" : 1540,
&amp;nbsp; "cityId" : 18,
&amp;nbsp; "cityName" : "Berlin"
}, {
&amp;nbsp; "new_att":"somevalue",
&amp;nbsp; "new_att2":"somevalue2",
&amp;nbsp; "new_att3":"somevalue3",
&amp;nbsp; "regId" : "us",
&amp;nbsp; "cId" : "SomeProduct",
&amp;nbsp; "weId" : 15,
&amp;nbsp; "name" : "R",
&amp;nbsp; "id" : 1541,
&amp;nbsp; "cityId" : 19,
&amp;nbsp; "cityName" : "Vienna"
} ]&lt;/PRE&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Rosa&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Jun 2019 00:09:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Add-json-object-in-the-json-content-of-flowfile/m-p/238036#M199847</guid>
      <dc:creator>rosa_negra</dc:creator>
      <dc:date>2019-06-04T00:09:58Z</dc:date>
    </item>
  </channel>
</rss>

