diff options
Diffstat (limited to 'MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs')
-rw-r--r-- | MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs b/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs index 725c832..b007136 100644 --- a/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs +++ b/MatrixRoomUtils.Core/Extensions/JsonElementExtensions.cs @@ -5,18 +5,16 @@ using System.Text.Json.Serialization; namespace MatrixRoomUtils.Core.Extensions; -public static class JsonElementExtensions -{ - public static void FindExtraJsonFields([DisallowNull] this JsonElement? res, Type t) - { +public static class JsonElementExtensions { + public static void FindExtraJsonFields([DisallowNull] this JsonElement? res, Type t) { var props = t.GetProperties(); var unknownPropertyFound = false; - foreach (var field in res.Value.EnumerateObject()) - { + foreach (var field in res.Value.EnumerateObject()) { if (props.Any(x => x.GetCustomAttribute<JsonPropertyNameAttribute>()?.Name == field.Name)) continue; Console.WriteLine($"[!!] Unknown property {field.Name} in {t.Name}!"); unknownPropertyFound = true; } - if(unknownPropertyFound) Console.WriteLine(res.Value.ToJson()); + + if (unknownPropertyFound) Console.WriteLine(res.Value.ToJson()); } } \ No newline at end of file |