<?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: Nifi JsonRecordSetWriter 1.17.0 Corrupting Data in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-JsonRecordSetWriter-1-17-0-Corrupting-Data/m-p/380769#M244156</link>
    <description>&lt;P&gt;By the way, this problem has been solved in the newer versions of JsonRecordSetWriter.&amp;nbsp; For example, 1.23.2.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Dec 2023 11:11:33 GMT</pubDate>
    <dc:creator>VladaY</dc:creator>
    <dc:date>2023-12-13T11:11:33Z</dc:date>
    <item>
      <title>Nifi JsonRecordSetWriter 1.17.0 Corrupting Data</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-JsonRecordSetWriter-1-17-0-Corrupting-Data/m-p/362449#M238779</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;I'm struggling with JsonRecordSetWriter 1.17.0, we have valid nested JSON data, but for some reason whenever this data passes through JsonRecordSetWriter, on nested arrays it adds the following :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;      "orderItemsCustomizes" : [ "MapRecord[{quantity=1, itemCurrency=AED, totalPrice=0, orderItemId=2767, itemCustomizeGroup=MapRecord[{itemModifierGroupAttributes=[Ljava.lang.Object;@4658e00e, customizeGroupName=Burger Selection}], itemCustomize=MapRecord[{itemCustomizeGroupId=2308, itemId=18622, itemName=Chicken Burger, isAvailabel=true, updated_at=2023-01-27 15:59:31, itemCurrency=AED, itemCost=0.00, created_at=2023-01-27 15:59:31, itemModifierAttributes=[Ljava.lang.Object;@ee87ab1, id=7539, itemImage=https://d2cvcbugmdflrn.cloudfront.net/e777bb72-a445-4162-9844-f9bda5e7a3d0.jpg}], itemId=18622, itemCustomizeGroupId=2308, createdAt=2023-01-27 16:48:02, itemCustomizeId=7539, price=0.00, ID=1153, updatedAt=2023-01-27 16:48:02}]", "MapRecord[{quantity=1, itemCurrency=AED, totalPrice=2, orderItemId=2767, itemCustomizeGroup=MapRecord[{itemModifierGroupAttributes=[Ljava.lang.Object;@d33701d, customizeGroupName=Fries Selection}], itemCustomize=MapRecord[{itemCustomizeGroupId=2309, itemId=18622, itemName=French Fries, isAvailabel=true, updated_at=2023-01-27 15:59:31, itemCurrency=AED, itemCost=2.00, created_at=2023-01-27 15:59:31, itemModifierAttributes=[Ljava.lang.Object;@f5ca635, id=7542, itemImage=null}], itemId=18622, itemCustomizeGroupId=2309, createdAt=2023-01-27 16:48:02, itemCustomizeId=7542, price=2.00, ID=1154, updatedAt=2023-01-27 16:48:02}]" ],
      &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've seen a bunch of posts where this is happening, any idea why does this happen?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 15:25:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-JsonRecordSetWriter-1-17-0-Corrupting-Data/m-p/362449#M238779</guid>
      <dc:creator>arshad10244</dc:creator>
      <dc:date>2023-01-29T15:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi JsonRecordSetWriter 1.17.0 Corrupting Data</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-JsonRecordSetWriter-1-17-0-Corrupting-Data/m-p/362452#M238780</link>
      <description>&lt;P&gt;Ok, i figured it out. For anyone having a similar issue:&lt;/P&gt;&lt;P&gt;This happens when you are using a JSON array using any of the built-in readers, with the settings of schema set to "infer schema" and the data type within your array changes,&lt;BR /&gt;&lt;BR /&gt;For instance consider the following array :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "items": [
    {
      "name": "John Doe",
      "type": []
    },
    {
      "name": "Jane Doe",
      "type": [
        {
          "some_key": [
            {
              "some_nested_key": "value"
            }
          ]
        }
      ]
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;Notice in the items array, the type of first index is an empty array, in the second index the type has a nested array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using 'infer schema', nifi scans the first element to construct the schema on the fly, which means it would map the "type" key as an array, and store it without storing any schema for the nested array that's present in the second index, the result would be type:[MapRecord...].&lt;BR /&gt;&lt;BR /&gt;The solution is to create your schema with entire structure first, simply remove the first element where type is an empty array and use &lt;A href="http://www.dataedu.ca/avro" target="_blank"&gt;http://www.dataedu.ca/avro&lt;/A&gt; to generate your schema, once that is done use AvroSchemaRegistry to save the schema and configure your recordreader to use the schema instead&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 16:40:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-JsonRecordSetWriter-1-17-0-Corrupting-Data/m-p/362452#M238780</guid>
      <dc:creator>arshad10244</dc:creator>
      <dc:date>2023-01-29T16:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi JsonRecordSetWriter 1.17.0 Corrupting Data</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-JsonRecordSetWriter-1-17-0-Corrupting-Data/m-p/380768#M244155</link>
      <description>&lt;P&gt;Thank u a lot!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 11:08:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-JsonRecordSetWriter-1-17-0-Corrupting-Data/m-p/380768#M244155</guid>
      <dc:creator>VladaY</dc:creator>
      <dc:date>2023-12-13T11:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi JsonRecordSetWriter 1.17.0 Corrupting Data</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-JsonRecordSetWriter-1-17-0-Corrupting-Data/m-p/380769#M244156</link>
      <description>&lt;P&gt;By the way, this problem has been solved in the newer versions of JsonRecordSetWriter.&amp;nbsp; For example, 1.23.2.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 11:11:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-JsonRecordSetWriter-1-17-0-Corrupting-Data/m-p/380769#M244156</guid>
      <dc:creator>VladaY</dc:creator>
      <dc:date>2023-12-13T11:11:33Z</dc:date>
    </item>
  </channel>
</rss>

