Skip to content

Commit

Permalink
Optimaze JsonSerializerOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
tba76 committed Jan 26, 2024
1 parent 7e34146 commit 43ecefe
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Altinn.Notifications.Sms.Core/Sending/Sms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ namespace Altinn.Notifications.Sms.Core.Sending;
/// </summary>
public class Sms
{
private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true
};

/// <summary>
/// Gets or sets the id of the sms.
/// </summary>
Expand Down Expand Up @@ -63,13 +68,7 @@ public static bool TryParse(string input, out Sms value)

try
{
parsedOutput = JsonSerializer.Deserialize<Sms>(
input!,
new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true
});

parsedOutput = JsonSerializer.Deserialize<Sms>(input!, _serializerOptions);
value = parsedOutput!;
return value.NotificationId != Guid.Empty;
}
Expand Down

0 comments on commit 43ecefe

Please sign in to comment.