<?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 From JSON to get Avro Schema in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/From-JSON-to-get-Avro-Schema/m-p/381914#M244446</link>
    <description>&lt;P&gt;Hi guys! I have a question about Avro schema.&lt;/P&gt;&lt;P&gt;My input flowfile are in json format and I want to convert it into xml. The method I use is using &lt;STRONG&gt;ConvertRecord Processor. &lt;/STRONG&gt;In terms of ConvertRecord Processor, I use JsonTreeReader as record reader and XMLRecordSetWriter as record writer. Following picture is the properties of JsonTreeReader I set it up. &lt;/P&gt;&lt;P&gt;Here is the json I want to convert:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
 "article":{
  "article-meta": {
   "art_id": "me08001",
   "title" : [ {
    "lang" : "en",
    "title" : "A"
    }, {
    "lang" : "hr",
    "title" : "B"
   } ]
  },
  "journal-meta": {
   "journal_id": "me9",
   "type" : "journal"
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have a lot of flowfile that contain this kind of format Json file, what Avro schema should I put inside&amp;nbsp;&lt;STRONG&gt;AvroSchemaRegistry. &lt;/STRONG&gt;I try a lot of online converter and it doesn't satisfy&amp;nbsp;AvroSchemaRegistry when I do validation. I need the Avro schema so that the ConvertRecord can read my JSON flowfile.&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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="Screenshot 2024-01-10 at 1.24.34 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39367i5001E8617A6A7743/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-01-10 at 1.24.34 PM.png" alt="Screenshot 2024-01-10 at 1.24.34 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-10 at 1.24.00 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39366iFD3EF5001DFE6C78/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-01-10 at 1.24.00 PM.png" alt="Screenshot 2024-01-10 at 1.24.00 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jan 2024 18:41:52 GMT</pubDate>
    <dc:creator>FrankHaha</dc:creator>
    <dc:date>2024-01-10T18:41:52Z</dc:date>
    <item>
      <title>From JSON to get Avro Schema</title>
      <link>https://community.cloudera.com/t5/Support-Questions/From-JSON-to-get-Avro-Schema/m-p/381914#M244446</link>
      <description>&lt;P&gt;Hi guys! I have a question about Avro schema.&lt;/P&gt;&lt;P&gt;My input flowfile are in json format and I want to convert it into xml. The method I use is using &lt;STRONG&gt;ConvertRecord Processor. &lt;/STRONG&gt;In terms of ConvertRecord Processor, I use JsonTreeReader as record reader and XMLRecordSetWriter as record writer. Following picture is the properties of JsonTreeReader I set it up. &lt;/P&gt;&lt;P&gt;Here is the json I want to convert:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
 "article":{
  "article-meta": {
   "art_id": "me08001",
   "title" : [ {
    "lang" : "en",
    "title" : "A"
    }, {
    "lang" : "hr",
    "title" : "B"
   } ]
  },
  "journal-meta": {
   "journal_id": "me9",
   "type" : "journal"
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have a lot of flowfile that contain this kind of format Json file, what Avro schema should I put inside&amp;nbsp;&lt;STRONG&gt;AvroSchemaRegistry. &lt;/STRONG&gt;I try a lot of online converter and it doesn't satisfy&amp;nbsp;AvroSchemaRegistry when I do validation. I need the Avro schema so that the ConvertRecord can read my JSON flowfile.&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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="Screenshot 2024-01-10 at 1.24.34 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39367i5001E8617A6A7743/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-01-10 at 1.24.34 PM.png" alt="Screenshot 2024-01-10 at 1.24.34 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-10 at 1.24.00 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/39366iFD3EF5001DFE6C78/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-01-10 at 1.24.00 PM.png" alt="Screenshot 2024-01-10 at 1.24.00 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 18:41:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/From-JSON-to-get-Avro-Schema/m-p/381914#M244446</guid>
      <dc:creator>FrankHaha</dc:creator>
      <dc:date>2024-01-10T18:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: From JSON to get Avro Schema</title>
      <link>https://community.cloudera.com/t5/Support-Questions/From-JSON-to-get-Avro-Schema/m-p/381921#M244448</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/108303"&gt;@FrankHaha&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Have you tried using the "&lt;SPAN&gt;Infer Schema"&amp;nbsp;&lt;STRONG&gt;Schema Access Strategy&lt;/STRONG&gt; in the&amp;nbsp;&lt;/SPAN&gt;&lt;A class="component-link" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-record-serialization-services-nar/1.24.0/org.apache.nifi.json.JsonTreeReader/index.html" target="component-usage"&gt;JsonTreeReader&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="version"&gt;1.24.0&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;controller services instead of fetching schema from AvroSchemaRegistry?&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Another option would be to use the&amp;nbsp;&lt;A class="component-link" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.24.0/org.apache.nifi.processors.standard.ExtractRecordSchema/index.html" target="component-usage"&gt;ExtractRecordSchema&amp;nbsp;&lt;SPAN class="version"&gt;1.24.0&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;processor along with&amp;nbsp;&lt;A class="component-link" href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-record-serialization-services-nar/1.24.0/org.apache.nifi.json.JsonTreeReader/index.html" target="component-usage"&gt;JsonTreeReader&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="version"&gt;1.24.0&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;controller services configured with&amp;nbsp;"&lt;SPAN&gt;Infer Schema"&amp;nbsp;&lt;STRONG&gt;Schema Access Strategy&lt;/STRONG&gt;" to output the schema into a FlowFile Attribute "avro.schema".&amp;nbsp; You can then get the produced schema from that FlowFile Attribute to add to your AvroSchemaRegsitry for future use.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on one or more of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 20:45:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/From-JSON-to-get-Avro-Schema/m-p/381921#M244448</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2024-01-10T20:45:14Z</dc:date>
    </item>
  </channel>
</rss>

