title: JOLT concat values from nested array (Apache NiFi)
body: <p>I have a JSON:</p>
  <pre><code>{
    &quot;reports&quot;: [
      {
        &quot;columnHeader&quot;: {
          &quot;metricHeader&quot;: {
            &quot;metricHeaderEntries&quot;: [
              {
                &quot;name&quot;: &quot;ga:sessions&quot;,
                &quot;type&quot;: &quot;INTEGER&quot;
              },
              {
                &quot;name&quot;: &quot;ga:bounces&quot;,
                &quot;type&quot;: &quot;INTEGER&quot;
              },
              {
                &quot;name&quot;: &quot;ga:sessionDuration&quot;,
                &quot;type&quot;: &quot;TIME&quot;
              },
              {
                &quot;name&quot;: &quot;ga:pageviews&quot;,
                &quot;type&quot;: &quot;INTEGER&quot;
              }
            ]
          }
        },
        &quot;data&quot;: {
          &quot;rows&quot;: [
            {
              &quot;metrics&quot;: [
                {
                  &quot;values&quot;: [
                    &quot;25&quot;,
                    &quot;18&quot;,
                    &quot;1269.0&quot;,
                    &quot;27&quot;
                  ]
                }
              ]
            }
          ],
          &quot;totals&quot;: [
            {
              &quot;values&quot;: [
                &quot;25&quot;,
                &quot;18&quot;,
                &quot;1269.0&quot;,
                &quot;27&quot;
              ]
            }
          ],
          &quot;rowCount&quot;: 1,
          &quot;minimums&quot;: [
            {
              &quot;values&quot;: [
                &quot;25&quot;,
                &quot;18&quot;,
                &quot;1269.0&quot;,
                &quot;27&quot;
              ]
            }
          ],
          &quot;maximums&quot;: [
            {
              &quot;values&quot;: [
                &quot;25&quot;,
                &quot;18&quot;,
                &quot;1269.0&quot;,
                &quot;27&quot;
              ]
            }
          ],
          &quot;isDataGolden&quot;: true
        }
      }
    ]
  }
  </code></pre>
  <p><code>metricHeaderEntries</code> and <code>values</code> for them are separated. Values are in <code>data.totals</code> array (order is saved correctly).
  I want to modify JSON and get following structure (or similar to this, I only need pairs metric.name = metric.value):</p>
  <pre><code>{
    &quot;metrics&quot;: [
              {
                &quot;name&quot;: &quot;ga:sessions&quot;,
                &quot;value&quot;: &quot;25&quot;
              },
              {
                &quot;name&quot;: &quot;ga:bounces&quot;,
                &quot;type&quot;: &quot;18&quot;
              },
              {
                &quot;name&quot;: &quot;ga:sessionDuration&quot;,
                &quot;type&quot;: &quot;1269.0&quot;
              },
              {
                &quot;name&quot;: &quot;ga:pageviews&quot;,
                &quot;type&quot;: &quot;27&quot;
              }
            ],
      &quot;isDataGolden&quot;: true      
  }
  </code></pre>
  <p>Is it possible with JOLT?
  Before I only used <code>shift</code> spec for some very easy tasks. Following spec:</p>
  <pre><code>[
    {
      &quot;operation&quot;: &quot;shift&quot;,
      &quot;spec&quot;: {
        &quot;reports&quot;: {
          &quot;*&quot;: {
            &quot;columnHeader&quot;: {
              &quot;metricHeader&quot;: {
                &quot;metricHeaderEntries&quot;: {
                  &quot;*&quot;: {
                    &quot;name&quot;: &quot;@(1,name)&quot;
                  }
                }
              }
            },
            &quot;isDataGolden&quot;: &quot;isDataGolden&quot;
          }
        }
      }
    }
  ]
  </code></pre>
  <p>Returns:</p>
  <pre><code>{
    &quot;ga:sessions&quot; : &quot;ga:sessions&quot;,
    &quot;ga:bounces&quot; : &quot;ga:bounces&quot;,
    &quot;ga:sessionDuration&quot; : &quot;ga:sessionDuration&quot;,
    &quot;ga:pageviews&quot; : &quot;ga:pageviews&quot;
  }
  </code></pre>
  <p>&quot;Almost&quot;. Not what i wanted of course. I need an array <code>metrics</code> with fields <code>name</code> and <code>value</code> as I described above. But I don't know how to get these values from <code>data.totals</code> and put them to metrics. And also <code>isDataGolden</code> disappeared. I read a little bit about <code>modify-overwrite-beta</code>, can i use it for my case?</p>