title: Find nested JSON objects using jq
body: <p>Is there a way to find the location, and values, of specific objects in heavily-nested JSON files, using jq?</p>
  <p>I never know where they are going to occur in the structure of the JSON, and I never know the names of the parents. I just know the name of the object I'm searching for.</p>
  <p>For example, I'm trying to find where the &quot;FIND_ME&quot; objects are in the following JSON, in relation to the JSON structure as a whole, but also the values contained in &quot;FIND_ME&quot;. So for this JSON:</p>
  <pre><code>{
      &quot;system&quot;: {
          &quot;operating_system_1&quot;: {
              &quot;FIND_ME&quot;: {
                  &quot;special_detail_1&quot;: &quot;some_detail&quot;,
                  &quot;special_detail_2&quot;: &quot;some_detail&quot;
              },
              &quot;feature_1&quot;: {
                  &quot;detail_1&quot;: &quot;some_detail&quot;
              },
              &quot;feature_2&quot;: {
                  &quot;detail_2&quot;: &quot;some_detail&quot;
              }
          },
          &quot;operating_system_2&quot;: {
              &quot;feature_1&quot;: {
                  &quot;FIND_ME&quot;: {
                      &quot;special_detail_3&quot;: &quot;some_detail&quot;,
                      &quot;special_detail_4&quot;: &quot;some_detail&quot;
                  },
                  &quot;detail_3&quot;: &quot;some_detail&quot;
              },
              &quot;feature_2&quot;: {
                  &quot;detail_4&quot;: &quot;some_detail&quot;
              }
          },
          &quot;operating_system_3&quot;: {
              &quot;feature_1&quot;: {
                  &quot;detail_5&quot;: &quot;some_detail&quot;
              },
              &quot;feature_2&quot;: {
                  &quot;detail_6&quot;: &quot;some_detail&quot;
              }
          }
      }
  }
  </code></pre>
  <p>I'd ideally get the following output:</p>
  <pre><code>{
      &quot;system&quot;: {
          &quot;operating_system_1&quot;: {
              &quot;FIND_ME&quot;: {
                  &quot;special_detail_1&quot;: &quot;some_detail&quot;,
                  &quot;special_detail_2&quot;: &quot;some_detail&quot;
              }
          },
          &quot;operating_system_2&quot;: {
              &quot;feature_1&quot;: {
                  &quot;FIND_ME&quot;: {
                      &quot;special_detail_3&quot;: &quot;some_detail&quot;,
                      &quot;special_detail_4&quot;: &quot;some_detail&quot;
                  }
              }
          }
      }
  }
  </code></pre>
  <p>This is so I can check numerous files to make sure &quot;FIND_ME&quot; isn't appearing somewhere it shouldn't be, causing errors.
  I've tried the following from other questions:</p>
  <pre><code>cat json_file | jq '..|.FIND_ME? | select(. != null)'
  </code></pre>
  <p>Which gives the values of &quot;FIND_ME&quot;, like this</p>
  <pre><code>{
    &quot;special_detail_1&quot;: &quot;some_detail&quot;,
    &quot;special_detail_2&quot;: &quot;some_detail&quot;
  }
  {
    &quot;special_detail_3&quot;: &quot;some_detail&quot;,
    &quot;special_detail_4&quot;: &quot;some_detail&quot;
  }
  </code></pre>
  <p>but it doesn't display the parent structure.</p>