Why are booleans in Stream Analytics sample outputs getting converted into 0's and 1's?

John Barhorst 0 Reputation points
2024-01-30T21:04:59.7766667+00:00

When using the data sampler available from Event Hubs -> namespace -> Process Data, and running the default sample query, we've recently noticed that values that would previously show as booleans are now converting into 0 or 1 in the "raw" JSON view.

Using other methods of observing the published data, the values are booleans.

According to the table view, the body of the message is of type record. So based on the documentation it should be a string representation of what was published without any conversions on values. However when viewing the the raw JSON data in the browser, or downloading those samples from within the Stream Analytics data sampler, the boolean values are converted.

We have a use case for viewing this data from that sampling page, so I'm looking for more information on what might be causing this conversion. Whether it be something in the way the data is published, some settings within Event Hubs, or just a quirk of the Stream Analytics sampling.

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
557 questions
Azure Stream Analytics
Azure Stream Analytics
An Azure real-time analytics service designed for mission-critical workloads.
330 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde 28,386 Reputation points MVP
    2024-01-30T22:28:49.2266667+00:00

    Hello @John Barhorst ,

    welcome to this moderated Azure community forum.

    In the documentation, a Boolean is not listed as supported data type.

    BIT: An integer that can take a value of 1, 0, or NULL. This is supported in compatibility level 1.2 and above.

    Azure Stream Analytics makes use of type mapping:

    BIT: string "true", "false", or "null" is converted to integer value 1, 0, or null correspondingly

    But in pass through deserialization, it seems to output 'true' and 'false':

    A pass-through query like SELECT value INTO output1 FROM input1 reading a JSON { "value": true } from input1 will write into the output1 a JSON value { "value": true }

    I recommend testing this if you output depends on this.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.