Update README.md

Alphons van der Heijden <alphons@heijden.com> 15 Dec 2023, 11:02
309447d7d8bccd1f8933f571615322979a16700a
1 files changed
  • README.md
diff --git a/README.md b/README.md
index 390d9fd..24c7bdf 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,8 @@
-# SkipNamesTypeInfoResolver
+# IgnoringJsonSerializer
Emulates jsonIgnore on anonymous types (sort of), filters out also empty objects! -> object1:{}
+## IgnoringJsonSerializer
```c#
using System.Collections;
@@ -58,3 +59,28 @@ public class IgnoringJsonSerializer
}
```
+
+## Test program
+
+```c#
+using System.Text.Json;
+using VMTux.VMTuxEmulator.DataModel.Form;
+
+namespace ConsoleApp1;
+
+internal class Program
+{
+ async static Task Main(string[] args)
+ {
+ var vm = DataEngine.GetVm();
+
+ var json0 = JsonSerializer.Serialize(vm, new JsonSerializerOptions() { WriteIndented = true });
+ var json1 = IgnoringJsonSerializer.Serialize(vm, new JsonSerializerOptions() { WriteIndented = true },
+ ["Icon", "Title", "Usage", "Type", "Options", "Default"]);
+
+ await File.WriteAllTextAsync("json0.json", json0);
+ await File.WriteAllTextAsync("json1.json", json1);
+ }
+}
+
+```