diff --git a/MyApp.ServiceInterface/AiServerServices.cs b/MyApp.ServiceInterface/AiServerServices.cs index 275bd6f..4c47bd7 100644 --- a/MyApp.ServiceInterface/AiServerServices.cs +++ b/MyApp.ServiceInterface/AiServerServices.cs @@ -341,7 +341,10 @@ public static string SanitizeBody(string? body) } catch (Exception) { - json = json.Replace("\"", "\\\""); + // Escape quotes, revert escaping JSON properties and try again + json = json.Replace("\"", "\\\"") + .Replace("\\\"reason\\\"", "\"reason\"") + .Replace("\\\"score\\\"", "\"score\""); obj = (Dictionary)JSON.parse(json); } var reason = obj.TryGetValue("reason", out var oReason)