Brent
❔ C# Dictionary Json Serialization problems
Hey everyone! I'm trying to Serialize a Dictionary with a class 'Manager' as Key, and an Enum 'Privilege' as Value. I know I could just use a normal list and put Privilege in the Manager class, but I have to use a Dictionary for a school project.
Im getting this error:
System.NotSupportedException: 'The type 'Globals.Manager' is not a supported dictionary key using converter of type 'System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1[Globals.Manager]'. The unsupported member type is located on type 'Globals.Privilege'. Path: $.'
I already added the IEquatable<T> interface to the manager class, but still getting the same error.
Could anyone help me please? Thanks in advance!
4 replies