From 2441ae81089e0f2be730dce431e629c4d948df99 Mon Sep 17 00:00:00 2001 From: Demis Bellot Date: Fri, 10 Jan 2025 13:58:18 +0800 Subject: [PATCH] improve double quote escaping --- MyApp.ServiceInterface/AiServerServices.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MyApp.ServiceInterface/AiServerServices.cs b/MyApp.ServiceInterface/AiServerServices.cs index 4c47bd7..38d389e 100644 --- a/MyApp.ServiceInterface/AiServerServices.cs +++ b/MyApp.ServiceInterface/AiServerServices.cs @@ -343,7 +343,8 @@ public static string SanitizeBody(string? body) { // Escape quotes, revert escaping JSON properties and try again json = json.Replace("\"", "\\\"") - .Replace("\\\"reason\\\"", "\"reason\"") + .Replace("\\\"reason\\\": \\\"", "\"reason\": \"") + .Replace("\\\",","\",") .Replace("\\\"score\\\"", "\"score\""); obj = (Dictionary)JSON.parse(json); }