using System.Text.Json; namespace Elsa.Api.Client.Extensions; /// /// Provides extension methods for . /// public static class JsonElementExtensions { /// /// Returns the value of the specified property if it exists, otherwise the default value. /// public static bool TryGetPropertySafe(this JsonElement element, string propertyName, out JsonElement value) { value = default; if(element.ValueKind != JsonValueKind.Object) return false; if (!element.TryGetProperty(propertyName, out var property)) return false; value = property; return true; } }