<?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: Jolt spec to flatten the nested JSON in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399089#M250398</link>
    <description>&lt;P&gt;&amp;nbsp;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/32119"&gt;@VidyaSargur&lt;/a&gt;&amp;nbsp;, Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Dec 2024 12:00:23 GMT</pubDate>
    <dc:creator>Velankanni</dc:creator>
    <dc:date>2024-12-19T12:00:23Z</dc:date>
    <item>
      <title>Jolt spec to flatten the nested JSON</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399054#M250380</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;I have the below Input JSON and would like to flatten the data into the below mentioned output JSON format. I am new to the JOLT, I tried to transform (its incomplete) but could not achieve the result.&lt;/P&gt;
&lt;P&gt;Kindly help me to get the desired output, thanks in advance.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Input JSON:&lt;/STRONG&gt;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
  "data": {
    "getItemListing": {
      "edges": [
        {
          "node": {
            "id": "2940126",
            "identifier": 3119650,
            "parentItems": [
              {
                "id": "364270",
                "parentIdentifier": 371153
              },
              {
                "id": "364258",
                "parentIdentifier": 371147
              }
            ],
            "treatmentClusterIds": [
              {
                "metadata": [
                  {
                    "treatmentClusterIDs": "528"
                  }
                ],
                "element": {
                  "name": "GOAT02",
                  "labelingClusters": [
                    {
                      "labelingCluster": "1000"
                    }
                  ]
                }
              },
              {
                "metadata": [
                  {
                    "treatmentClusterIDs": "529"
                  }
                ],
                "element": {
                  "name": "GOAT03",
                  "labelingClusters": [
                    {
                      "labelingCluster": "4045"
                    }
                  ]
                }
              },
              {
                "metadata": [
                  {
                    "treatmentClusterIDs": "5581"
                  }
                ],
                "element": {
                  "name": "GOAT04",
                  "labelingClusters": [
                    {
                      "labelingCluster": "2000"
                    },
                    {
                      "labelingCluster": "3000"
                    },
                    {
                      "labelingCluster": "4000"
                    }
                  ]
                }
              }
            ]
          }
        },
        {
          "node": {
            "id": "2940127",
            "identifier": 3119651,
            "parentItems": [
              {
                "id": "364270",
                "parentIdentifier": 371154
              }
            ],
            "treatmentClusterIds": [
              {
                "metadata": [
                  {
                    "treatmentClusterIDs": "527"
                  }
                ],
                "element": {
                  "name": "GOAT01",
                  "labelingClusters": [
                    {
                      "labelingCluster": "1000"
                    },
                    {
                      "labelingCluster": "4045"
                    },
                    {
                      "labelingCluster": "2000"
                    },
                    {
                      "labelingCluster": "3000"
                    },
                    {
                      "labelingCluster": "4000"
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  }
}&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Output JSON:&lt;/STRONG&gt;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[ {
  "identifier": "3119650",
  "parentIdentifier": "371153",
  "Element" : "GOAT02",
  "TreatmentId" : "528",
  "LabelingCluster" : "1000"
}, {
  "identifier": "3119650",
  "parentIdentifier": "371153",
  "Element" : "GOAT03",
  "TreatmentId" : "529",
  "LabelingCluster" : "4045"
}, {
  "identifier": "3119650",
  "parentIdentifier": "371153",
  "Element" : "GOAT04",
  "TreatmentId" : "5581",
  "LabelingCluster" : "2000"
}, {
  "identifier": "3119650",
  "parentIdentifier": "371153",
  "Element" : "GOAT04",
  "TreatmentId" : "5581",
  "LabelingCluster" : "3000"
}, {
  "identifier": "3119650",
  "parentIdentifier": "371153",
  "Element" : "GOAT04",
  "TreatmentId" : "5581",
  "LabelingCluster" : "4000"
}, {
  "identifier": "3119650",
  "parentIdentifier": "371147",
  "Element" : "GOAT02",
  "TreatmentId" : "528",
  "LabelingCluster" : "1000"
}, {
  "identifier": "3119650",
  "parentIdentifier": "371147",
  "Element" : "GOAT03",
  "TreatmentId" : "529",
  "LabelingCluster" : "4045"
}, {
  "identifier": "3119650",
  "parentIdentifier": "371147",
  "Element" : "GOAT04",
  "TreatmentId" : "5581",
  "LabelingCluster" : "2000"
}, {
  "identifier": "3119650",
  "parentIdentifier": "371147",
  "Element" : "GOAT04",
  "TreatmentId" : "5581",
  "LabelingCluster" : "3000"
}, {
  "identifier": "300119650",
  "parentIdentifier": "371147",
  "Element" : "GOAT04",
  "TreatmentId" : "5581",
  "LabelingCluster" : "4000"
}, {
  "identifier": "3119651",
  "parentIdentifier": "371154",
  "Element" : "GOAT01",
  "TreatmentId" : "527",
  "LabelingCluster" : "1000"
}, {
  "identifier": "3119651",
  "parentIdentifier": "371154",
  "Element" : "GOAT01",
  "TreatmentId" : "527",
  "LabelingCluster" : "4045"
}, {
  "identifier": "3119651",
  "parentIdentifier": "371154",
  "Element" : "GOAT01",
  "TreatmentId" : "527",
  "LabelingCluster" : "2000"
}, {
  "identifier": "3119651",
  "parentIdentifier": "371154",
  "Element" : "GOAT01",
  "TreatmentId" : "527",
  "LabelingCluster" : "3000"
}, {
  "identifier": "3119651",
  "parentIdentifier": "371154",
  "Element" : "GOAT01",
  "TreatmentId" : "527",
  "LabelingCluster" : "4000"
} ]&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;JOLT spec I tired (incomplete):&lt;/STRONG&gt;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[
  {
    "operation": "shift",
    "spec": {
      "data": {
        "getItemListing": {
          "edges": {
            "*": {
              "node": {
                "treatmentClusterIds": {
                  "*": "[]"
                }
              }
            }
          }
        }
      }
    }
 }, {
    "operation": "shift",
    "spec": {
      "*": {
        "element": {
          "labelingClusters": {
            "*": {
              "labelingCluster": "[&amp;amp;4].[&amp;amp;1].LabelingCluster",
              "@(2,name)": "[&amp;amp;4].[&amp;amp;1].Element",
              "@3,metadata": {
                "*": {
                  "treatmentClusterIDs": "[&amp;amp;6].[&amp;amp;2].TreatmentId"
                }
              }
            }
          }
        }
      }
    }
 },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": "[]"
      }
    }
 }
]&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 05:47:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399054#M250380</guid>
      <dc:creator>Velankanni</dc:creator>
      <dc:date>2024-12-19T05:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: Jolt spec to flatten the nested JSON</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399056#M250382</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/122636"&gt;@Velankanni&lt;/a&gt;,&amp;nbsp;Welcome to our community! To help you get the best possible answer, I have tagged in our NiFi experts&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&amp;nbsp; who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please feel free to provide any additional information or details about your query. We hope that you will find a satisfactory solution to your question.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 05:48:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399056#M250382</guid>
      <dc:creator>VidyaSargur</dc:creator>
      <dc:date>2024-12-19T05:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Jolt spec to flatten the nested JSON</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399089#M250398</link>
      <description>&lt;P&gt;&amp;nbsp;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/32119"&gt;@VidyaSargur&lt;/a&gt;&amp;nbsp;, Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 12:00:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399089#M250398</guid>
      <dc:creator>Velankanni</dc:creator>
      <dc:date>2024-12-19T12:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Jolt spec to flatten the nested JSON</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399147#M250422</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/122636"&gt;@Velankanni&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Can you explain what are you trying to accomplish with the transformation?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was having a hard time understanding how you came up with output given that you are pulling fields from different arrays with different cardinality.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 14:53:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399147#M250422</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2024-12-19T14:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Jolt spec to flatten the nested JSON</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399159#M250424</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/122636"&gt;@Velankanni&lt;/a&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;If you are still having&amp;nbsp; the problem&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="2"&gt;you can you try this JOLT remember the spoiler tag distorts the JSON&amp;nbsp;&lt;BR /&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;JOLT Spec&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;FONT size="2"&gt;[&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"operation": "shift",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"spec": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"data": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"getItemListing": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"edges": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"node": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"identifier": "[&amp;amp;1].identifier",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"parentItems": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"parentIdentifier": "[&amp;amp;3].[&amp;amp;1].parentIdentifier"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;},&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"treatmentClusterIds": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"metadata": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"treatmentClusterIDs": "[&amp;amp;4].[&amp;amp;2].[&amp;amp;1].TreatmentId"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;},&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"element": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"name": "[&amp;amp;4].[&amp;amp;2].[&amp;amp;1].Element",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"labelingClusters": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"labelingCluster": "[&amp;amp;5].[&amp;amp;3].[&amp;amp;2].LabelingCluster"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;},&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"operation": "shift",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"spec": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"*": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"$": "[#6].identifier",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"parentIdentifier": "[#6].parentIdentifier",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"Element": "[#6].Element",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"TreatmentId": "[#6].TreatmentId",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;"LabelingCluster": "[#6].LabelingCluster"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;BR /&gt;]&lt;/LI-SPOILER&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Place the &lt;STRONG&gt;Input JSON&lt;/STRONG&gt; in a file&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;input.json&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Use a JOLT processor&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;Apply the spec above and verify the output matches the &lt;STRONG&gt;Output JSON&lt;/STRONG&gt; format.&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Happy hadooping&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 17:09:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399159#M250424</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2024-12-19T17:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: Jolt spec to flatten the nested JSON</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399174#M250429</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;, Thank you, this JSON is for Bill Of Materials and we have to flatten the entire array at each node and repeat the array values to other columns.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 01:44:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399174#M250429</guid>
      <dc:creator>Velankanni</dc:creator>
      <dc:date>2024-12-20T01:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Jolt spec to flatten the nested JSON</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399178#M250431</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/122636"&gt;@Velankanni&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;I got to say that this is one of the most complex jolt I have ever written. Im starting to question if its even worth doing it because it will make maintaining the the spec very hard. I would urge you to look at this &lt;A href="https://community.cloudera.com/t5/Support-Questions/How-to-convert-Nested-JSON-to-Flattened-JSON-using-JOLT/m-p/398693#M250287" target="_self"&gt;post&lt;/A&gt; which has similar request of flattening complex json and there I recommended to use JSTL transformation spec instead as it would simplify things by a lot.&lt;/P&gt;&lt;P&gt;As far as the jolt spec , I was able to do it in 4 transformation:&lt;/P&gt;&lt;P&gt;1- Start form the leaf "labelingCluster" and work your way up to collect common data for each node and assign arrays for the values of metadata &amp;amp; parent identifiers.&lt;/P&gt;&lt;P&gt;2- traverse the metadata array from step 1 to replicate the values from above against each metadata array item.&lt;/P&gt;&lt;P&gt;3- traverse the parent identifier array from step 1 to replicate the values from step2 against each parent identifier array item.&lt;/P&gt;&lt;P&gt;4- Bucket result from step3 into single array&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It important to maintain parent\sub array&amp;nbsp; index position during each transformation to help you group fields correctly.&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;LI-CODE lang="markup"&gt;[
  {
    "operation": "shift",
    "spec": {
      "data": {
        "getItemListing": {
          "edges": {
            "*": {
              "node": {
                "treatmentClusterIds": {
                  "*": {
                    "element": {
                      "labelingClusters": {
                        "*": {
                          "labelingCluster": {
                            "@(3,name)": "[&amp;amp;8].treatmentClusterIds[&amp;amp;5].labelingClusters[&amp;amp;2].Element",
                            "@(6,identifier)": "[&amp;amp;8].treatmentClusterIds[&amp;amp;5].labelingClusters[&amp;amp;2].identifier",
                            "@": "[&amp;amp;8].treatmentClusterIds[&amp;amp;5].labelingClusters[&amp;amp;2].labelingCluster",
                            "@(4,metadata)": {
                              "*": {
                                "treatmentClusterIDs": "[&amp;amp;10].treatmentClusterIds[&amp;amp;7].labelingClusters[&amp;amp;4].metadata[]"
                              }
                            },
                            "@(6,parentItems)": {
                              "*": {
                                "parentIdentifier": "[&amp;amp;10].treatmentClusterIds[&amp;amp;7].labelingClusters[&amp;amp;4].parentId[]"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "treatmentClusterIds": {
          "*": {
            "labelingClusters": {
              "*": {
                "metadata": {
                  "*": {
                    "@(2,identifier)": "[&amp;amp;7].treatmentClusterIds[&amp;amp;5].labelingClusters[&amp;amp;3][&amp;amp;1].identifier",
                    "@": "[&amp;amp;7].treatmentClusterIds[&amp;amp;5].labelingClusters[&amp;amp;3][&amp;amp;1].TreatmentId",
                    "@(2,Element)": "[&amp;amp;7].treatmentClusterIds[&amp;amp;5].labelingClusters[&amp;amp;3][&amp;amp;1].Element",
                    "@(2,labelingCluster)": "[&amp;amp;7].treatmentClusterIds[&amp;amp;5].labelingClusters[&amp;amp;3][&amp;amp;1].labelingCluster",
                    "@(2,parentId)": "[&amp;amp;7].treatmentClusterIds[&amp;amp;5].labelingClusters[&amp;amp;3][&amp;amp;1].parentId"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  ,
  {
    "operation": "shift",
    "spec": {
      "*": {
        "treatmentClusterIds": {
          "*": {
            "labelingClusters": {
              "*": {
                "*": {
                  "parentId": {
                    "*": {
                      "@(2,identifier)": "[&amp;amp;8].treatmentClusterIds[&amp;amp;6].labelingClusters[&amp;amp;4][&amp;amp;3][&amp;amp;1].identifier",
                      "@": "[&amp;amp;8].treatmentClusterIds[&amp;amp;6].labelingClusters[&amp;amp;4][&amp;amp;3][&amp;amp;1].parentIdentifier",
                      "@(2,Element)": "[&amp;amp;8].treatmentClusterIds[&amp;amp;6].labelingClusters[&amp;amp;4][&amp;amp;3][&amp;amp;1].Element",
                      "@(2,TreatmentId)": "[&amp;amp;8].treatmentClusterIds[&amp;amp;6].labelingClusters[&amp;amp;4][&amp;amp;3][&amp;amp;1].TreatmentId",
                      "@(2,labelingCluster)": "[&amp;amp;8].treatmentClusterIds[&amp;amp;6].labelingClusters[&amp;amp;4][&amp;amp;3][&amp;amp;1].labelingCluster"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "treatmentClusterIds": {
          "*": {
            "labelingClusters": {
              "*": {
                "*": {
                  "*": "[]"
                }
              }
            }
          }
        }
      }
    }
  }

]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, look into JSTL spec to simplify, or try to break up the json and store into database where you can easily perform sql queries to flatten the data using join&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this helps please accept the solution&lt;/P&gt;&lt;P&gt;Thanks&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;</description>
      <pubDate>Fri, 20 Dec 2024 04:33:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399178#M250431</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2024-12-20T04:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Jolt spec to flatten the nested JSON</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399180#M250432</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;This works really fine. Thank you so much for your solution.&lt;/P&gt;&lt;P&gt;I got your idea of splitting the JSON and perform the transformation in SQL table. I will work on that.&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 05:23:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Jolt-spec-to-flatten-the-nested-JSON/m-p/399180#M250432</guid>
      <dc:creator>Velankanni</dc:creator>
      <dc:date>2024-12-20T05:23:41Z</dc:date>
    </item>
  </channel>
</rss>

