Querying JSON array with Azure Stream Analytics


Kent Weare has written a nice post on querying Json array with Azure Stream Analytics. He is getting device reads off of an Azure Event Hub. These reads are being aggregated on the publisher side and placed into a single message/event. Since the publisher is creating a message structure that contains many device reads for that specific interval Kent wanted to ensure he can process each element in the array within Stream Analytics query.

Comments (1)

  1. STANLEY_AUS says:

    Thanks. I studied the query, applied it to a test file and it works! However, when I tried to send the OUTPUT to a file like

    SELECT deviceData.ArrayValue AS tag
    INTO [datapowerBI]
    FROM [TESTIOTHUB] AS e
    CROSS APPLY GetArrayElements(e.deviceData) AS deviceData

    against JSON string,

    {“deviceData”:[{“What”:”Voltage”,”RecOnUTC”:”2016-06-27T11:48:55Z”,”Val”:251},{“What”:”Current”,”RecOnUTC”:”2016-06-27T11:48:55Z”,”Val”:0}]}

    In the OUTPUT dataset, was only a single data ‘tag’.

    Where did I go wrong? Thank you.

Skip to main content