Hello Dragan Antanasković ,
Thank you for reaching out on Microsoft Q&A.
To extract values from the variables JSON array in Azure Stream Analytics, you can use the GetArrayElements function with CROSS APPLY. This method efficiently handles the array and avoids the need for a JavaScript UDF.
Sample Query
SELECT
sessionId,
scheduleId,
screen,
eventType,
mergedEventId,
duration,
v.Name AS variableName,
v.Value AS variableValue,
timestamp,
deviceTimeStamp
FROM YourInput
CROSS APPLY GetArrayElements(variables) AS v
- GetArrayElements: Breaks down the variables array into individual elements.
- CROSS APPLY: Joins the input stream with the elements of the variables array, allowing access to Name and Value.
If you found this solution helpful, consider accepting it.