<?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: getting null from JoltTransformJson in nifi while converting a plain json to nested json in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/getting-null-from-JoltTransformJson-in-nifi-while-converting/m-p/395977#M249071</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/119204"&gt;@RanjitMohapatra&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future.&amp;nbsp; Thanks.&lt;/P&gt;
&lt;DIV class="UserSignature lia-message-signature"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Fri, 25 Oct 2024 17:01:49 GMT</pubDate>
    <dc:creator>DianaTorres</dc:creator>
    <dc:date>2024-10-25T17:01:49Z</dc:date>
    <item>
      <title>getting null from JoltTransformJson in nifi while converting a plain json to nested json</title>
      <link>https://community.cloudera.com/t5/Support-Questions/getting-null-from-JoltTransformJson-in-nifi-while-converting/m-p/395687#M248997</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using JoltTransformJson to convert a plain json to nested json in Nifi and getting null in the output. The same i/p and spec is working in Jolt demo. Below are the input and the spec&amp;nbsp;&lt;BR /&gt;Input:&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"ts" : "2024-09-22T12:03:13.000Z",&lt;BR /&gt;"sourceDeviceId" : 4321,&lt;BR /&gt;"sourceName" : "light1",&lt;BR /&gt;"sourceType" : "light",&lt;BR /&gt;"locationLat" : 201.34,&lt;BR /&gt;"locationLon" : 101.5,&lt;BR /&gt;"locationId" : 1,&lt;BR /&gt;"recordDate" : "2024-09-22T12:03:13.000Z",&lt;BR /&gt;"_class" : "com.prutech.smartcity.entity.LightEntity",&lt;BR /&gt;"_id" : "66f27c487bd8652abecdb9c7",&lt;BR /&gt;"status" : "INACTIVE",&lt;BR /&gt;"power" : 0,&lt;BR /&gt;"current" : 0,&lt;BR /&gt;"intensity" : 100,&lt;BR /&gt;"voltage" : 0&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Jolt Spec:&lt;/P&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"operation": "shift",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"spec":{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"ts":"ts",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"sourceDeviceId":"source.deviceId",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"sourceName":"source.name",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"sourceType":"source.type",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"locationLat":"location.lat",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"locationLon":"location.lon",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"locationId":"location.id",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"recordDate":"recordDate",&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"_class":"_class",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"status":"status",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"power":"power",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"current":"current",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"intensity":"intensity",&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"voltage":"voltage"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;P&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 06:49:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/getting-null-from-JoltTransformJson-in-nifi-while-converting/m-p/395687#M248997</guid>
      <dc:creator>RanjitMohapatra</dc:creator>
      <dc:date>2024-10-22T06:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: getting null from JoltTransformJson in nifi while converting a plain json to nested json</title>
      <link>https://community.cloudera.com/t5/Support-Questions/getting-null-from-JoltTransformJson-in-nifi-while-converting/m-p/395730#M249012</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/119204"&gt;@RanjitMohapatra&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NiFi expects the &lt;STRONG&gt;Jolt specification&lt;/STRONG&gt; to be provided as an &lt;STRONG&gt;array of objects &lt;/STRONG&gt;if it's set chain. This is typical when using &lt;STRONG&gt;JoltTransformJSON&lt;/STRONG&gt; because it supports multiple transformations chained together.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Also, if you click on your JoltTransformJSON and click on the advanced option -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="drewski7_1-1729609032503.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42304iF7AF0021FAFD3889/image-size/medium?v=v2&amp;amp;px=400" role="button" title="drewski7_1-1729609032503.png" alt="drewski7_1-1729609032503.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;It will bring up a nice Jolt Spec tester for you that is consistent with how NiFi will handle the transformation -&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="drewski7_0-1729608992995.png" style="width: 544px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42303i3454954A803C4945/image-dimensions/544x245?v=v2" width="544" height="245" role="button" title="drewski7_0-1729608992995.png" alt="drewski7_0-1729608992995.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Solution is just wrapping it in an array.&lt;/P&gt;&lt;PRE&gt;[&lt;BR /&gt;    {&lt;BR /&gt;          "operation": "shift",&lt;BR /&gt;          "spec": {&lt;BR /&gt;               "ts": "ts",&lt;BR /&gt;               "sourceDeviceId": "source.deviceId",&lt;BR /&gt;               "sourceName": "source.name",&lt;BR /&gt;               "sourceType": "source.type",&lt;BR /&gt;               "locationLat": "location.lat",&lt;BR /&gt;               "locationLon": "location.lon",&lt;BR /&gt;               "locationId": "location.id",&lt;BR /&gt;               "recordDate": "recordDate",&lt;BR /&gt;               "_class": "_class",&lt;BR /&gt;               "status": "status",&lt;BR /&gt;               "power": "power",&lt;BR /&gt;               "current": "current",&lt;BR /&gt;               "intensity": "intensity",&lt;BR /&gt;               "voltage": "voltage"&lt;BR /&gt;           }&lt;BR /&gt;      }&lt;BR /&gt;]&lt;/PRE&gt;&lt;P&gt;Please &lt;STRONG&gt;accept the solution!&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 14:59:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/getting-null-from-JoltTransformJson-in-nifi-while-converting/m-p/395730#M249012</guid>
      <dc:creator>drewski7</dc:creator>
      <dc:date>2024-10-22T14:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: getting null from JoltTransformJson in nifi while converting a plain json to nested json</title>
      <link>https://community.cloudera.com/t5/Support-Questions/getting-null-from-JoltTransformJson-in-nifi-while-converting/m-p/395977#M249071</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/119204"&gt;@RanjitMohapatra&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future.&amp;nbsp; Thanks.&lt;/P&gt;
&lt;DIV class="UserSignature lia-message-signature"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 25 Oct 2024 17:01:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/getting-null-from-JoltTransformJson-in-nifi-while-converting/m-p/395977#M249071</guid>
      <dc:creator>DianaTorres</dc:creator>
      <dc:date>2024-10-25T17:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: getting null from JoltTransformJson in nifi while converting a plain json to nested json</title>
      <link>https://community.cloudera.com/t5/Support-Questions/getting-null-from-JoltTransformJson-in-nifi-while-converting/m-p/403925#M252234</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a similar issue. When I use "Advanced" to check what output nifi would provide, I get the output there, but when I check the queue after the JoltTransformJSON has processed the output, it says null. I changed "Jolt Transform DSL" from "chain" to "default", as it eliminated the space that was there between the square brackets and the array elements in an array. This is my Jolt specification -&lt;/P&gt;&lt;P&gt;[&lt;BR /&gt;{&lt;BR /&gt;"operation": "shift",&lt;BR /&gt;"spec": {&lt;BR /&gt;"uid": "uid",&lt;BR /&gt;"location_name": "name",&lt;BR /&gt;"location_city": "city",&lt;BR /&gt;"age_min": "age_min",&lt;BR /&gt;"age_max": "age_max",&lt;BR /&gt;"firstdate_begin": "begin",&lt;BR /&gt;"lastdate_end": "end",&lt;BR /&gt;"location_coordinates": {&lt;BR /&gt;"lon": "location[0]",&lt;BR /&gt;"lat": "location[1]"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;and this is the expected output -&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"uid": "54570223",&lt;BR /&gt;"name": "Théâtre Plaza",&lt;BR /&gt;"city": "Montréal",&lt;BR /&gt;"age_min": null,&lt;BR /&gt;"age_max": null,&lt;BR /&gt;"begin": "2024-03-23T23:30:00+00:00",&lt;BR /&gt;"end": "2024-03-24T01:00:00+00:00",&lt;BR /&gt;"location": [ -73.603196, 45.536315 ]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;EDIT -&lt;/P&gt;&lt;P&gt;I edited my jolt specification, and it looks like this now-&lt;/P&gt;&lt;P&gt;[&lt;BR /&gt;{&lt;BR /&gt;"operation": "shift",&lt;BR /&gt;"spec": {&lt;BR /&gt;"*": {&lt;BR /&gt;"uid": "uid",&lt;BR /&gt;"location_name": "location_name",&lt;BR /&gt;"location_city": "location_city",&lt;BR /&gt;"age_min": "age_min",&lt;BR /&gt;"age_max": "age_max",&lt;BR /&gt;"firstdate_begin": "firstdate_begin",&lt;BR /&gt;"lastdate_end": "lastdate_end",&lt;BR /&gt;"location_coordinates": {&lt;BR /&gt;"lon": "location[0]",&lt;BR /&gt;"lat": "location[1]"&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;I am getting the desired output -&lt;BR /&gt;{&lt;BR /&gt;"uid": "70029814",&lt;BR /&gt;"location_name": "Sanctuaire du Saint-Sacrement",&lt;BR /&gt;"location_city": "Montreal",&lt;BR /&gt;"age_min": null,&lt;BR /&gt;"age_max": null,&lt;BR /&gt;"firstdate_begin": "2019-04-13T18:00:00+00:00",&lt;BR /&gt;"lastdate_end": "2019-04-14T10:00:00+00:00",&lt;BR /&gt;"location": [-73.581721, 45.525243]&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;But the issue now is that after processing, the output looks something like this -&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"uid" : [ "54570223" ],&lt;BR /&gt;"location_name" : [ "Théâtre Plaza" ],&lt;BR /&gt;"location_city" : [ "Montréal" ],&lt;BR /&gt;"age_min" : [ 16 ],&lt;BR /&gt;"age_max" : [ 99 ],&lt;BR /&gt;"firstdate_begin" : [ "2024-03-23T23:30:00+00:00" ],&lt;BR /&gt;"lastdate_end" : [ "2024-03-24T01:00:00+00:00" ],&lt;BR /&gt;"location" : [ [ -73.603196 ], [ 45.536315 ] ]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Working on keeping only the location as arrays. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2025 00:29:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/getting-null-from-JoltTransformJson-in-nifi-while-converting/m-p/403925#M252234</guid>
      <dc:creator>kavyashree</dc:creator>
      <dc:date>2025-03-12T00:29:53Z</dc:date>
    </item>
  </channel>
</rss>

