title: Processing Array of Arrays in Azure Stream Analytics
body: <p>I have this JSON Structure fed to my ASA:</p>
  
  <pre class="lang-json prettyprint-override"><code>[{
    "Stages": [
      {
        "Name": "Stage 1",
        "Count": 45,
        "First": "2018-12-17T11:31:12.7448439-04:00",
        "Average": 1.0,
        "Max": 0.0
      },
      {
        "Name": "Stage 2",
        "Count": 7,
        "First": "2018-12-17T11:31:12.7448469-04:00",
        "Average": 0.0,
        "Max": 0.0
      }
    ],
    "DateTimeET": "2018-12-17T11:31:12.7448477-04:00",
    "Division": "One"
  }]
  </code></pre>
  
  <p>I'm stuck on how to get the Name, Count, First, Average and Max for each element within the Stages Array. </p>
  
  <p>I did this: </p>
  
  <pre class="lang-sql prettyprint-override"><code>WITH CTE AS (
      SELECT  
          event.Division
          ,event.DateTimeET
          ,StageElement
      FROM
          StageSummary AS event
      CROSS APPLY getarrayelements(event.Stages) AS StageElement
  )
  
  SELECT
      event2.Division
      ,event2.DateTimeET
      ,event2.StageElement
  FROM
      CTE AS event2
  </code></pre>
  
  <p>and I can get the array using the GetRecordProperties, but I get the full array again, I can't get something specific as 'Name' or 'Count'</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Update: </p>
  
  <p>I'm using the query as follows: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>WITH CTE AS (
      SELECT  
          event.Division
          ,event.DateTimeET
          ,StageElement
      FROM
          StageSummary AS event
      CROSS APPLY getarrayelements(event.Stages) AS StageElement
  )
  
  SELECT
      event2.Division
      ,event2.DateTimeET
      ,getrecordpropertyvalue(Elements,'Name') AS NameValue
  FROM
      CTE AS event2
      CROSS APPLY getrecordproperties(event2.StageElement) AS Elements</code></pre>
  </div>
  </div>
  </p>
  
  <p>but NameValue returns empty.</p>