private static JsonSerializerOptions GetHtmlSafeSerializerOptions(JsonSerializerOptions serializerOptions) { if (serializerOptions.Encoder is null || serializerOptions.Encoder == JavaScriptEncoder.Default) { return(serializerOptions); } return(serializerOptions.Copy(JavaScriptEncoder.Default)); }
public NdjsonWriter(Stream writeStream, JsonOptions jsonOptions) { _writeStream = writeStream; _jsonSerializerOptions = jsonOptions.JsonSerializerOptions; if (_jsonSerializerOptions.Encoder is null) { _jsonSerializerOptions = _jsonSerializerOptions.Copy(JavaScriptEncoder.UnsafeRelaxedJsonEscaping); } }