Closed isabr85 closed 3 years ago
Unfortunately I only support using enum as strings. The current UseEnumString flag in the settings class only let you either use the int or name representation of enum. But both will still be within a quote string.
I do have an option that let register a custom deserializer using NetJSON.RegisterCustomTypeDeserializer but I have not really done a lot of work on it. Since all it does is overwrite/intercept my implementation of deserialization for the type and calls the static method you register.
Please reopen if my answer doesn't work for you.
I have made a simple class, Customer, it contains member with type of enum: Gender:
public enum Gender { Male = 0, Female = 1 }
` public class CustomerI am trying to deserialize this json:
{ "FirstName": "First Name Test", "LastName": "Last Name Test", "Age": 30, "Address": "Neverland", "gender": 1 }
But it cause an exception: "Must specify valid information for parsing in the string." I guess that it happen because enum is set with int.What can I do in order to be able to deserialize my json with not exception?