Skip to content

Commit

Permalink
Allow 'unsafe' characters in outputting config json (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carael authored Nov 14, 2023
1 parent 84b9a43 commit 9c1b71c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -200,7 +201,11 @@ public static async Task SerializeToStreamAsync(
=> await JsonSerializer.SerializeAsync(
stream,
node,
new JsonSerializerOptions { WriteIndented = true },
new JsonSerializerOptions
{
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
},
cancellationToken);

[GeneratedRegex(@"^(?<name>.+?)\[(?<index>\d+)]$")]
Expand Down

0 comments on commit 9c1b71c

Please sign in to comment.