<?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: Can we flatten complex JSON file using NIFI.? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130012#M39323</link>
    <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/641/mburgess.html"&gt;@Matt Burgess&lt;/A&gt; , &lt;A href="https://community.hortonworks.com/users/2956/jfrazee.html"&gt;@jfrazee&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/2956/jfrazee.html"&gt;&lt;/A&gt;I wrote this Shift transformation in NiFi JOLT , which is flattening above JSON..just wanted to make sure of this would be the correct approach..?? Only thing is if we come across a new Tag in input then we will have to write transformations to it.&lt;/P&gt;&lt;P&gt;{
"glossary": {
"title": "Glossary Title",
"GlossDiv": {
"title*": "GlossDivTitles",
"GlossList": {
"GlossEntry": {
"ID": "GlossEntryID",
"SortAs": "GlossEntrySortAs",
"GlossTerm": "GlossEntryGT",
"Acronym": "GlossEntryAcronym",
"Abbrev": "GlossEntryAbbr",
"GlossDef": {
"*" : "GlossDef&amp;amp;"
},
"GlossSee": "GlossEntryGSee"
}
}
}
}
}&lt;/P&gt;</description>
    <pubDate>Tue, 06 Sep 2016 23:35:09 GMT</pubDate>
    <dc:creator>saikrishna_tara</dc:creator>
    <dc:date>2016-09-06T23:35:09Z</dc:date>
    <item>
      <title>Can we flatten complex JSON file using NIFI.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130004#M39315</link>
      <description>&lt;P&gt;Hi ,Can we flatten complex JSON files (with lists,arrays etc)with NIFI.?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 03:53:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130004#M39315</guid>
      <dc:creator>saikrishna_tara</dc:creator>
      <dc:date>2016-09-01T03:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can we flatten complex JSON file using NIFI.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130005#M39316</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11732/saikrishnatarapareddy.html" nodeid="11732"&gt;@Saikrishna Tarapareddy&lt;/A&gt;, Apache NiFi 1.0 includes the &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.JoltTransformJSON/index.html"&gt;JoltTransformJSON&lt;/A&gt; processor, which embeds the &lt;A href="http://bazaarvoice.github.io/jolt/"&gt;Jolt&lt;/A&gt; JSON-to-JSON transformation library. JoltTransformJSON can indeed be used to flatten JSON.&lt;/P&gt;&lt;P&gt;You can see an example of using the processor here: &lt;A href="https://community.hortonworks.com/articles/44726/json-to-json-simplified-with-apache-nifi-and-jolt.html" target="_blank"&gt;https://community.hortonworks.com/articles/44726/json-to-json-simplified-with-apache-nifi-and-jolt.html&lt;/A&gt; &lt;/P&gt;&lt;P&gt;And there's an example of a Jolt spec to flatten JSON here: &lt;A href="http://jolt-demo.appspot.com/#bucketToPrefixSoup" target="_blank"&gt;http://jolt-demo.appspot.com/#bucketToPrefixSoup&lt;/A&gt; &lt;/P&gt;&lt;P&gt;HDF 2.0, forthcoming, includes Apache NiFi 1.0, so going forward this will likely be the right way to do it.
As an alternative, you could use a scripted processor to do something similar. See: &lt;A href="http://funnifi.blogspot.com/2016/02/executescript-json-to-json-conversion.html" target="_blank"&gt;http://funnifi.blogspot.com/2016/02/executescript-json-to-json-conversion.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 04:03:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130005#M39316</guid>
      <dc:creator>jfrazee</dc:creator>
      <dc:date>2016-09-01T04:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can we flatten complex JSON file using NIFI.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130006#M39317</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2956/jfrazee.html" nodeid="2956" target="_blank"&gt;@jfrazee&lt;/A&gt;&lt;/P&gt;&lt;P&gt;when I tried to look at these examples , its not showing any JSON or specs. All I get is empty screen like this..&lt;/P&gt;&lt;P&gt;when I tried this link below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://jolt-demo.appspot.com/#bucketToPrefixSoup" rel="nofollow noopener noreferrer" target="_blank"&gt;http://jolt-demo.appspot.com/#bucketToPrefixSoup&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="7251-jolt.png" style="width: 1879px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/22401i3F200D6FA8D3148A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="7251-jolt.png" alt="7251-jolt.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 09:36:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130006#M39317</guid>
      <dc:creator>saikrishna_tara</dc:creator>
      <dc:date>2019-08-19T09:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can we flatten complex JSON file using NIFI.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130007#M39318</link>
      <description>&lt;P&gt;Not really sure why it's not loading the examples for you but the JSON input that page should have loaded is:&lt;/P&gt;&lt;PRE&gt;{
  "Rating": 1,
  "SecondaryRatings": {
    "Design": 4,
    "Price": 2,
    "RatingDimension3": 1
  }
}
&lt;/PRE&gt;&lt;P&gt;And the Jolt spec is:&lt;/P&gt;&lt;PRE&gt;[
  {
    "operation": "shift",
    "spec": {
      "Rating": "rating-primary",
      //
      // Turn all the SecondaryRatings into prefixed data
      // like "rating-Design" : 4
      "SecondaryRatings": {
        // the "&amp;amp;" in "rating-&amp;amp;" means go up the tree 0 levels,
        // grab what is ther and subtitute it in
        "*": "rating-&amp;amp;"
      }
    }
  }
]
&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Sep 2016 01:21:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130007#M39318</guid>
      <dc:creator>jfrazee</dc:creator>
      <dc:date>2016-09-02T01:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can we flatten complex JSON file using NIFI.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130008#M39319</link>
      <description>&lt;P&gt;If you click on any of the examples,it should fill in the Input and Spec boxes.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 01:23:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130008#M39319</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2016-09-02T01:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can we flatten complex JSON file using NIFI.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130009#M39320</link>
      <description>&lt;P style="margin-left: 80px;"&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;&lt;P&gt;i tried to do that , but it is not filling in the Input or Specs.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 04:40:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130009#M39320</guid>
      <dc:creator>saikrishna_tara</dc:creator>
      <dc:date>2016-09-02T04:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can we flatten complex JSON file using NIFI.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130010#M39321</link>
      <description>&lt;P&gt;Here's the example for "prefix soup" (a kind of flattening):&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;PRE&gt;{
"Rating": 1,
"SecondaryRatings": {
"Design": 4,
"Price": 2,
"RatingDimension3": 1
}
}&lt;/PRE&gt;&lt;P&gt;Spec:&lt;/P&gt;&lt;PRE&gt;[
  {
    "operation": "shift",
    "spec": {
      "Rating": "rating-primary",
      //
      // Turn all the SecondaryRatings into prefixed data
      // like "rating-Design" : 4
      "SecondaryRatings": {
        // the "&amp;amp;" in "rating-&amp;amp;" means go up the tree 0 levels,
        // grab what is ther and subtitute it in
        "*": "rating-&amp;amp;"
      }
    }
  }
]&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Sep 2016 04:50:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130010#M39321</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2016-09-02T04:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can we flatten complex JSON file using NIFI.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130011#M39322</link>
      <description>&lt;P style="margin-left: 100px;"&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; &lt;A rel="user" href="https://community.cloudera.com/users/2956/jfrazee.html" nodeid="2956"&gt;@jfrazee&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Where can i find help for JOLT JSON transformations..i am trying to flatten this example json with multi levels.&lt;/P&gt;&lt;P&gt;{ &lt;/P&gt;&lt;P&gt;"glossary": { &lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;"title": "example glossary", &lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;"GlossDiv": { &lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"title": "S", &lt;/P&gt;&lt;P style="margin-left: 40px;"&gt;"GlossList": { &lt;/P&gt;&lt;P style="margin-left: 60px;"&gt;"GlossEntry": { &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;"ID": "SGML", &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;"SortAs": "SGML", &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;"GlossTerm": "Standard Generalized Markup Language", &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;"Acronym": "SGML", &lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;"Abbrev": "ISO 8879:1986",&lt;/P&gt;&lt;P style="margin-left: 80px;"&gt;
"GlossDef": { &lt;/P&gt;&lt;P style="margin-left: 120px;"&gt;"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"] &lt;/P&gt;&lt;P style="margin-left: 100px;"&gt;}, &lt;/P&gt;&lt;P style="margin-left: 100px;"&gt;"GlossSee": "markup" &lt;/P&gt;&lt;P style="margin-left: 100px;"&gt;} &lt;/P&gt;&lt;P style="margin-left: 100px;"&gt;} &lt;/P&gt;&lt;P style="margin-left: 100px;"&gt;} &lt;/P&gt;&lt;P style="margin-left: 100px;"&gt;} &lt;/P&gt;&lt;P style="margin-left: 100px;"&gt;}&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2016 03:16:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130011#M39322</guid>
      <dc:creator>saikrishna_tara</dc:creator>
      <dc:date>2016-09-03T03:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can we flatten complex JSON file using NIFI.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130012#M39323</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/641/mburgess.html"&gt;@Matt Burgess&lt;/A&gt; , &lt;A href="https://community.hortonworks.com/users/2956/jfrazee.html"&gt;@jfrazee&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/2956/jfrazee.html"&gt;&lt;/A&gt;I wrote this Shift transformation in NiFi JOLT , which is flattening above JSON..just wanted to make sure of this would be the correct approach..?? Only thing is if we come across a new Tag in input then we will have to write transformations to it.&lt;/P&gt;&lt;P&gt;{
"glossary": {
"title": "Glossary Title",
"GlossDiv": {
"title*": "GlossDivTitles",
"GlossList": {
"GlossEntry": {
"ID": "GlossEntryID",
"SortAs": "GlossEntrySortAs",
"GlossTerm": "GlossEntryGT",
"Acronym": "GlossEntryAcronym",
"Abbrev": "GlossEntryAbbr",
"GlossDef": {
"*" : "GlossDef&amp;amp;"
},
"GlossSee": "GlossEntryGSee"
}
}
}
}
}&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2016 23:35:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130012#M39323</guid>
      <dc:creator>saikrishna_tara</dc:creator>
      <dc:date>2016-09-06T23:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can we flatten complex JSON file using NIFI.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130013#M39324</link>
      <description>&lt;P&gt; + &lt;A rel="user" href="https://community.cloudera.com/users/2956/jfrazee.html" nodeid="2956"&gt;@jfrazee&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>Fri, 09 Sep 2016 20:06:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-we-flatten-complex-JSON-file-using-NIFI/m-p/130013#M39324</guid>
      <dc:creator>SQLShaw</dc:creator>
      <dc:date>2016-09-09T20:06:43Z</dc:date>
    </item>
  </channel>
</rss>

