<?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: Composing Json in Nifi in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/286551#M70139</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35418"&gt;@ask_bill_brooks&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, i am not seeing the accept as solution option in my screen.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Dec 2019 04:42:00 GMT</pubDate>
    <dc:creator>Siraj</dc:creator>
    <dc:date>2019-12-30T04:42:00Z</dc:date>
    <item>
      <title>Composing Json in Nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/232207#M70132</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have this scenario where after reading json files I'm doing InvokeHttp against a url attribute in each json file. This returns a further list of json objects with url attribute which I later split and do InvokeHttp individually against each url for result. &lt;/P&gt;&lt;P&gt;Now the problem is at the end I need to have a composed json against each flow resulting from the inital json that I read from file along with the later json objects and the final result received after hitting individual url. I need to save this composed json as record in mongodb.&lt;/P&gt;&lt;P&gt;I 'm having troubling making this json, so need help regarding the flow and processors.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 02:13:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/232207#M70132</guid>
      <dc:creator>arsalan_siddiqi</dc:creator>
      <dc:date>2017-10-24T02:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Composing Json in Nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/232208#M70133</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/9304/tspann.html" nodeid="9304"&gt;@Timothy Spann&lt;/A&gt; &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 02:17:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/232208#M70133</guid>
      <dc:creator>arsalan_siddiqi</dc:creator>
      <dc:date>2017-10-24T02:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Composing Json in Nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/232209#M70134</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/13785/arsalan-siddiqi.html" nodeid="13785" target="_blank"&gt;@Arsalan Siddiqi&lt;/A&gt;&lt;/P&gt;&lt;P&gt;One way to do this is &lt;STRONG&gt;extract all the content of the json file&lt;/STRONG&gt; as &lt;STRONG&gt;attributes&lt;/STRONG&gt; associated with the flowfile.&lt;/P&gt;&lt;P&gt;Then once you make&lt;STRONG&gt; invoke http&lt;/STRONG&gt; extract the results of invokehttp to attributes again.&lt;/P&gt;&lt;P&gt;By following this process all the contents will be associated as attributes of the flowfile i.e the &lt;STRONG&gt;attributes associated&lt;/STRONG&gt; with the flowfile includes the &lt;STRONG&gt;content of your json file, results of your invoke http&lt;/STRONG&gt; processors because we are &lt;STRONG&gt;extracting every content &lt;/STRONG&gt;and keeping them as &lt;STRONG&gt;attributes to the flowfile&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;In final use &lt;STRONG&gt;AttributesToJson&lt;/STRONG&gt; processor and keep all the &lt;STRONG&gt;attributes you need&lt;/STRONG&gt; in that, this processor will result a&lt;STRONG&gt; json message&lt;/STRONG&gt; and store that to mongodb.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Flow:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;1.EvaluateJsonProcessor //extract the content to flowfile attribute
2.invokehttp 
3.EvaluateJsonProcessor//extract the result of invoke http to flowfile attribute
4.AttributesToJSON //give all the list of attributes you need. so that this processor prepares new json message.&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Input Json file:-&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;{
"id": 1,
"name": "HCC",
"age": 20
}&lt;/PRE&gt;&lt;P&gt;extract all the content i.e id,name,age using &lt;STRONG&gt;Evaluatejsonpath&lt;/STRONG&gt; change &lt;STRONG&gt;Destination&lt;/STRONG&gt; property to&lt;STRONG&gt; &lt;/STRONG&gt;&lt;STRONG&gt;flowfile-attribute&lt;/STRONG&gt; processor, now all the content will be associated as attributes now.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Evaljsonpath configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41501-evaluatejsonpath.png" style="width: 706px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14860iC7B2A6E9D2592792/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41501-evaluatejsonpath.png" alt="41501-evaluatejsonpath.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then do &lt;STRONG&gt;invokehttp&lt;/STRONG&gt; now the &lt;STRONG&gt;result flowfile &lt;/STRONG&gt;from invokehttp also will have&lt;STRONG&gt; id,name,age &lt;/STRONG&gt;attributes associated with it.&lt;/P&gt;&lt;P&gt;use another &lt;STRONG&gt;evaluatejsonpath(&lt;/STRONG&gt;if response from invokehttp is json) and extract the invokehttp results as attributes again.&lt;/P&gt;&lt;P&gt;lets consder invokehttpresult will have&lt;/P&gt;&lt;PRE&gt;{ "dept": "community"} &lt;/PRE&gt;&lt;P&gt;extract dept as attribute.&lt;/P&gt;&lt;P&gt;Right now your flowfile will have&lt;STRONG&gt; id,name,age,dept &lt;/STRONG&gt;as&lt;STRONG&gt; attributes &lt;/STRONG&gt;to the flowfile.&lt;/P&gt;&lt;P&gt;you can do as many invokehttps as you want after each &lt;STRONG&gt;invoke http extract the content as attribute&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Now you need to prepare a json message use &lt;STRONG&gt;AttribiutestoJSON &lt;/STRONG&gt;processor &lt;/P&gt;&lt;P&gt;Change the property&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;attributes list&lt;/STRONG&gt; as&lt;/P&gt;&lt;PRE&gt;id,name,age,dept&lt;/PRE&gt;&lt;P&gt;This processor now prepares new json message with all the attributes you listed in the processor.&lt;/P&gt;&lt;PRE&gt;{ "id": 1, "name": "HCC", "age": 20,"dept": "community"}&lt;/PRE&gt;&lt;P&gt;Use the json result from Attributestojson processor to store into &lt;STRONG&gt;mongoDB&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;AttributesToJSON Configs:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41502-attributestojson.png" style="width: 669px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14861i76CE130E75874DB7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41502-attributestojson.png" alt="41502-attributestojson.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 00:28:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/232209#M70134</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T00:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Composing Json in Nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/232210#M70135</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/13785/arsalan-siddiqi.html"&gt;rsalan Siddiqi&lt;/A&gt; how did you solve ur prblm ? I have same use case&lt;/P&gt;,&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/13785/arsalan-siddiqi.html"&gt;rsalan Siddiqi&lt;/A&gt; how did you solve this prblm ? I have same use case&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 22:31:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/232210#M70135</guid>
      <dc:creator>monikanaagardec</dc:creator>
      <dc:date>2019-02-11T22:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Composing Json in Nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/286255#M70136</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/55311"&gt;@Shu_ashu&lt;/a&gt;&amp;nbsp;/ All,&lt;/P&gt;&lt;P&gt;I have a nested JSON (not an array).&lt;/P&gt;&lt;P&gt;I am able to read it using "&lt;U&gt;EvaluateJsonPath&lt;/U&gt;" for all the direct attributes (IMEI or Counter in my case). The nested attributes(&lt;STRONG&gt;$.Events.EvenType.Name&lt;/STRONG&gt; or &lt;STRONG&gt;$.&lt;/STRONG&gt;&lt;STRONG&gt;Events.Properties.Latitude&lt;/STRONG&gt;) is not recognized and they are getting populated as NULL in my destination table. Can you please advise?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Data Pipeline is as:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;GetFile --EvaluateJSONPath -- ConvertJSONtoSQL -- PutSQL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;EvaluateJSONPath Property (as attached):&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EvaluateJSON_Property.PNG" style="width: 664px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/25814iFB411648CD73B6CF/image-size/large?v=v2&amp;amp;px=999" role="button" title="EvaluateJSON_Property.PNG" alt="EvaluateJSON_Property.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Sample JSON Data:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;"IMEI":"77777777777777",&lt;/P&gt;&lt;P&gt;"Events":&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;"EventType":{"Name":"EventName","Time":1577184434,"ReceievedTime":1577184434,"MsgId":1493134167},&lt;/P&gt;&lt;P&gt;"Properties":{"ThingUnitId":"779000000000062","Latitude":"24","Longitude":"46"&lt;/P&gt;&lt;P&gt;},"Counter":0&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2019 12:37:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/286255#M70136</guid>
      <dc:creator>Siraj</dc:creator>
      <dc:date>2019-12-24T12:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: Composing Json in Nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/286276#M70137</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;The below pipeline solved the issue.&lt;/P&gt;&lt;P&gt;The naming convention between the table and the Property/value in Nifi has to be set same.&lt;/P&gt;&lt;P&gt;If not, it cannot recognize and either it will fail or NULL gets loaded. It is not as simple as expanding the the JSON using SQLServer query!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;&lt;/U&gt;: Value data in the &lt;STRONG&gt;EvoluteJSONPath&lt;/STRONG&gt; is setup based on the &lt;STRONG&gt;FlattenJSON&lt;/STRONG&gt; output. I had the "Seperator" as '_' and "Flattenmode" as 'dot notation' in the FlattenJSON setup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JSON_NestedData_PipeLine.png" style="width: 897px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/25815i3BB57EE7D654E5D9/image-size/large?v=v2&amp;amp;px=999" role="button" title="JSON_NestedData_PipeLine.png" alt="JSON_NestedData_PipeLine.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2019 15:10:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/286276#M70137</guid>
      <dc:creator>Siraj</dc:creator>
      <dc:date>2019-12-24T15:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Composing Json in Nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/286549#M70138</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/72165"&gt;@Siraj&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Looking over your most recent post it appears that you solved your issue. Can you confirm by using the &lt;EM&gt;Accept as Solution&lt;/EM&gt; button here so it can be of assistance to others?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cloudera community accept solution button created 2019-12-14_19-46-50.jpg" style="width: 338px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/25872iD123BA28D098C022/image-size/large?v=v2&amp;amp;px=999" role="button" title="cloudera community accept solution button created 2019-12-14_19-46-50.jpg" alt="cloudera community accept solution button created 2019-12-14_19-46-50.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 04:37:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/286549#M70138</guid>
      <dc:creator>ask_bill_brooks</dc:creator>
      <dc:date>2019-12-30T04:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Composing Json in Nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/286551#M70139</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35418"&gt;@ask_bill_brooks&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, i am not seeing the accept as solution option in my screen.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 04:42:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Composing-Json-in-Nifi/m-p/286551#M70139</guid>
      <dc:creator>Siraj</dc:creator>
      <dc:date>2019-12-30T04:42:00Z</dc:date>
    </item>
  </channel>
</rss>

