Hey team,
I'm looking for some advise and/or workaround for my issue. My goal is to create a JSON string (pretty and non-pretty).
As of now, I am using the JsonEventFormatter with the indentation options. The SDK is however not respecting this setting.
The below codebase is showing this problem.
var exampleEvent = new CloudEvent()
{
Id = "example-id",
Source = new Uri("http://test.com"),
Type = "example-type"
};
var formatter = new JsonEventFormatter(new JsonSerializerOptions
{
WriteIndented = true
}, new JsonDocumentOptions());
byte[] bytes = formatter.EncodeStructuredModeMessage(exampleEvent, out _).ToArray();
var jsonString = Encoding.UTF8.GetString(bytes);
Result:
