title: Use jq to parse key path for each each leaf
body: <p>(I’m not sure the technical terms to use but can update the question if someone can clarify the terminology I’m lacking for what I'm trying to do. It might help someone find this answer in the future.)</p>
  <p>Given the input JSON, how would I use jq to produce the expected output?</p>
  <p>Input:</p>
  <pre><code>{
      &quot;items&quot;: {
          &quot;item1&quot;: {
              &quot;part1&quot;: {
                  &quot;a&quot;: {
                      &quot;key1&quot;: &quot;value&quot;,
                      &quot;key2&quot;: &quot;value&quot;
                  },
                  &quot;b&quot;: {
                      &quot;key1&quot;: &quot;value&quot;,
                      &quot;key2&quot;: &quot;value&quot;
                  }
              },
              &quot;part2&quot;: {
                  &quot;c&quot;: {
                      &quot;key1&quot;: &quot;value&quot;,
                      &quot;key2&quot;: &quot;value&quot;
                  },
                  &quot;d&quot;: {
                      &quot;key1&quot;: &quot;value&quot;,
                      &quot;key2&quot;: &quot;value&quot;
                  }
              }
          },
          &quot;item2&quot;: {
              &quot;part3&quot;: {
                  &quot;e&quot;: {
                      &quot;key1&quot;: &quot;value&quot;,
                      &quot;key2&quot;: &quot;value&quot;
                  },
                  &quot;f&quot;: {
                      &quot;key1&quot;: &quot;value&quot;,
                      &quot;key2&quot;: &quot;value&quot;
                  }
              },
              &quot;part4&quot;: {
                  &quot;g&quot;: {
                      &quot;key1&quot;: &quot;value&quot;,
                      &quot;key2&quot;: &quot;value&quot;
                  },
                  &quot;h&quot;: {
                      &quot;key1&quot;: &quot;value&quot;,
                      &quot;key2&quot;: &quot;value&quot;
                  }
              }
          }
      }
  }
  </code></pre>
  <p>Expected output:</p>
  <pre><code>{
      &quot;item1&quot;: [
          &quot;part1.a&quot;,
          &quot;part1.b&quot;,
          &quot;part2.c&quot;,
          &quot;part2.d&quot;
      ]
      &quot;item2&quot;: [
          &quot;part3.e&quot;,
          &quot;part3.f&quot;
          &quot;part4.g&quot;,
          &quot;part4.h&quot;
      ]
  }
  </code></pre>