I have structure like this:
public enum Roles
{
ROLE_1,
ROLE_2,
ROLE_3,
...
ROLE_20
}
public enum Status
{
NONE,
ACTIVE,
REFUSE
...
}
Depend on user I can receive from API various number of roles in JSON like this:
{
"ROLE_1": "NONE",
"ROLE_2": "ACTIVE"
"ROLE_3": "ACTIVE"
}
or
{
"ROLE_2": "ACTIVE"
}
What is the best way to handle this in C# .Net? I was thinking about a dictionary but I don’t know how to serialize this properly.
I tried handle this with dynamic object, but maybe is the easier way to resolve this?