Using JSONPath to get only top level children
<p>I have a JSON array that contains 4 objects each with an <code>id</code> field.  The fourth object contains two children that each also have an <code>id</code> field.  I want to only get the ids of the 4 top level children; I don't want the ids of the children of the 4th element.</p>

<p>This is a simplified version of the JSON string:</p>

<pre><code>[
  {
    "id": 709709537
  },
  {
    "id": 1104067257
  },
  {
    "id": 2961327618
  },
  {
    "id": 9066007668,
    "photo": {
      "id": 461295287,
      "thumbnails": [
        {
          "id": 461295307
        }
      ]
    }
  }
]
</code></pre>

<p>Using JSONPath, <code>$..id</code> will get me all 6 id elements, with no way to determine which level they come from, e.g.</p>

<pre><code>[  
   709709537,
   1104067257,
   2961327618,
   9066007668,
   461295287,
   461295307
]
</code></pre>

<p>I expected <code>$.id</code> to give me the 4 top level <code>id</code> children, but this gets me nothing.</p>

<p>I've researched many pages and tried several experiments using JSON testers (e.g. <a href="https://jsonpath.curiousconcept.com/" rel="noreferrer">https://jsonpath.curiousconcept.com/</a>) and cannot find a JSONPath expression to get just the top 4 children id elements.</p>

<p>Is there a JSONPath expression that will get me just the top level children ids?</p>