@Andre - Thanks for the question and using MS Q&A platform.
When sending JSON events to Azure Event Hubs REST API, if the request is successful, it returns a code 201 and no text. However, if there is an error, such as a misspelled instance name in the URL or an ill-formed Shared Access Signature, the response text is returned in XML format.
Unfortunately, it is not possible to influence this behavior and change the error response format to JSON. This is because the Azure Event Hubs REST API is designed to return error responses in XML format, and this behavior cannot be changed.
Similarly, the Azure Blob Storage API also returns error responses in XML format, and this behavior cannot be changed either.
However, you can parse the XML error response and convert it to JSON format in your application code if needed. There are several libraries available in different programming languages that can help you parse XML and convert it to JSON.
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.