title: How to prevent ConvertFrom-Json from collapsing nested arrays if there's 1 element
body: <p>Consider these two JSON files:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;tables&quot;: [
      {
        &quot;columns&quot;: [
          {
            &quot;name&quot;: &quot;action&quot;,
            &quot;type&quot;: &quot;string&quot;
          },
          {
            &quot;name&quot;: &quot;region&quot;,
            &quot;type&quot;: &quot;string&quot;
          },
          {
            &quot;name&quot;: &quot;count_&quot;,
            &quot;type&quot;: &quot;long&quot;
          },
          {
            &quot;name&quot;: &quot;min_timestamp&quot;,
            &quot;type&quot;: &quot;datetime&quot;
          },
          {
            &quot;name&quot;: &quot;max_timestamp&quot;,
            &quot;type&quot;: &quot;datetime&quot;
          }
        ],
        &quot;name&quot;: &quot;PrimaryResult&quot;,
        &quot;rows&quot;: [
          [
            &quot;ChangePassword&quot;,
            &quot;CN&quot;,
            1,
            &quot;2022-07-19T11:51:52.8430729Z&quot;,
            &quot;2022-07-19T11:51:52.8430729Z&quot;
          ]
        ]
      }
    ]
  }
  </code></pre>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;tables&quot;: [
      {
        &quot;columns&quot;: [
          {
            &quot;name&quot;: &quot;action&quot;,
            &quot;type&quot;: &quot;string&quot;
          },
          {
            &quot;name&quot;: &quot;region&quot;,
            &quot;type&quot;: &quot;string&quot;
          },
          {
            &quot;name&quot;: &quot;count_&quot;,
            &quot;type&quot;: &quot;long&quot;
          },
          {
            &quot;name&quot;: &quot;min_timestamp&quot;,
            &quot;type&quot;: &quot;datetime&quot;
          },
          {
            &quot;name&quot;: &quot;max_timestamp&quot;,
            &quot;type&quot;: &quot;datetime&quot;
          }
        ],
        &quot;name&quot;: &quot;PrimaryResult&quot;,
        &quot;rows&quot;: [
          [
            &quot;ChangePassword&quot;,
            &quot;CN&quot;,
            1,
            &quot;2022-07-19T11:51:52.8430729Z&quot;,
            &quot;2022-07-19T11:51:52.8430729Z&quot;
          ],
          [
            &quot;Register&quot;,
            &quot;CN&quot;,
            1,
            &quot;2022-07-19T11:51:52.8430729Z&quot;,
            &quot;2022-07-19T11:51:52.8430729Z&quot;
          ]
        ]
      }
    ]
  }
  </code></pre>
  <p>They have the exact same schema and are almost the same. The difference is that first file has 1 row in the <code>rows</code> property, the second file has 2 rows in the <code>rows</code> property.</p>
  <hr />
  <p>I use <code>ConvertFrom-Json</code> to load the files into PowerShell. When I start accessing <code>.tables.rows[0]</code>, I expect that it will return the first row.</p>
  <p>However, in the first file that has only 1 row, it actually returns the first column of the first row.</p>
  <pre><code>(gc file1.json | ConvertFrom-Json).tables.rows[0]
  </code></pre>
  <p>Outputs:</p>
  <pre><code>ChangePassword
  </code></pre>
  <hr />
  <p>If there are more than 1 row as in the second file, then the <code>.tables.rows[0]</code> behaves as expected.</p>
  <pre><code>(gc file2.json | ConvertFrom-Json).tables.rows[0]
  </code></pre>
  <p>Outputs:</p>
  <pre><code>ChangePassword
  CN
  1
  2022-07-19T11:51:52.8430729Z
  2022-07-19T11:51:52.8430729Z
  </code></pre>
  <hr />
  <p>How can I reliably process these JSON files in PowerShell regardless of if they have 1 row or multiple rows in them?</p>
  <p>btw. These are actually JSON files produced by <code>az cli</code> as results from Azure Application Insights queries.</p>