Serializer does not handle escaping JSON properly - new lines etc.
2026-01-27 11:22:45.620 [Error] Connect: System.Text.Json.JsonReaderException thrown '0x0A' is invalid within a JSON string. The string should be correctly escaped. LineNumber: 27 | BytePositionInLine: 39.
Internal JSON for settings should be properly escaped.
System.Text.Json.JsonReaderException: '0x0A' is invalid within a JSON string. The string should be correctly escaped. LineNumber: 27 | BytePositionInLine: 39.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
at System.Text.Json.Utf8JsonReader.ConsumeStringAndValidate(ReadOnlySpan`1 data, Int32 idx)
at System.Text.Json.Utf8JsonReader.ConsumeString()
at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
at System.Text.Json.Utf8JsonReader.Read()
at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack)
at System.Text.Json.JsonDocument.ParseUnrented(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, JsonTokenType tokenType, Boolean allowDuplicateProperties)
at System.Text.Json.JsonDocument.ParseValue(ReadOnlySpan`1 json, JsonDocumentOptions options)
at System.Text.Json.Nodes.JsonNode.Parse(String json, Nullable`1 nodeOptions, JsonDocumentOptions documentOptions)
at Deepgram.Clients.Agent.v2.WebSocket.Client.Connect(SettingsSchema options, CancellationTokenSource cancelToken, Dictionary`2 addons, Dictionary`2 headers)
at Playground.Deepgram.DeepgramVoiceAssistant.ConfigureAndConnectAsync(CancellationToken cancellationToken) in
xxx\Playground.Deepgram\DeepgramVoiceAssistant.cs:line 217
What is the current behavior?
Serializer does not handle escaping JSON properly - new lines etc.
Steps to reproduce
Put new lines and other special characters to
[SettingsSchema]settings.Agent.Think.Promptproperty.Expected behavior
Internal JSON for settings should be properly escaped.
Please tell us about your environment
Windows 11
Other information