mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-03 00:29:20 +00:00
12 lines
411 B
C#
12 lines
411 B
C#
using System.Text.Json;
|
|
|
|
namespace DiscordChatExporter.Domain.Internal
|
|
{
|
|
internal static class JsonElementExtensions
|
|
{
|
|
public static JsonElement? GetPropertyOrNull(this JsonElement element, string propertyName) =>
|
|
element.TryGetProperty(propertyName, out var result) && result.ValueKind != JsonValueKind.Null
|
|
? result
|
|
: (JsonElement?) null;
|
|
}
|
|
} |