Skip to content

Commit

Permalink
improve double quote escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Jan 10, 2025
1 parent 3ab6e6a commit 2441ae8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion MyApp.ServiceInterface/AiServerServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, object>)JSON.parse(json);
}
Expand Down

0 comments on commit 2441ae8

Please sign in to comment.