about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs b/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs

index 78f4456..36da644 100644 --- a/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs +++ b/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs
@@ -7,7 +7,7 @@ using System.Text.Json.Serialization; namespace MatrixRoomUtils.Core.Extensions; public static class JsonElementExtensions { - public static void FindExtraJsonElementFields([DisallowNull] this JsonElement? res, Type t) { + public static bool FindExtraJsonElementFields([DisallowNull] this JsonElement? res, Type t) { var props = t.GetProperties(); var unknownPropertyFound = false; foreach (var field in res.Value.EnumerateObject()) { @@ -17,8 +17,10 @@ public static class JsonElementExtensions { } if (unknownPropertyFound) Console.WriteLine(res.Value.ToJson()); + + return unknownPropertyFound; } - public static void FindExtraJsonObjectFields([DisallowNull] this JsonObject? res, Type t) { + public static bool FindExtraJsonObjectFields([DisallowNull] this JsonObject? res, Type t) { var props = t.GetProperties(); var unknownPropertyFound = false; foreach (var field in res) { @@ -31,5 +33,7 @@ public static class JsonElementExtensions { } if (unknownPropertyFound) Console.WriteLine(res.ToJson()); + + return unknownPropertyFound; } } \ No newline at end of file