Search code examples
azureazure-stream-analytics

Could not deserialize the input event(s) from resource as Json


I´m trying to send data from an excel file to stream analytics. But I´m getting the provided error in Azure Stream Analytics.

Data:


    Daten ConvertToJson = new Daten
    {
    Drehmoment = Int32.Parse(dt.Rows[i][2].ToString()),
    };

Send message to eventhub - stream analytics:

var json = JsonConvert.SerializeObject(ConvertToJson);

var message = $"Message {json}";
await eventHubClient.SendAsync(new EventData(Encoding.UTF8.GetBytes(message)));

Solution

  • The payload must be array of Objects or a single object or whitespace separated objects. In the example about, payload is a string. This is not supported. If you changed it to below, it would create a record with single field.

    var message = JsonConvert.SerializeObject(ConvertToJson);