MapsterMapper / Mapster

A fast, fun and stimulating object to object Mapper
MIT License
4.31k stars 328 forks source link

Mapster.JsonNet does not support Enum to string mapping #502

Open ChristopheLionet opened 1 year ago

ChristopheLionet commented 1 year ago

The following code attempts to map a JObject to a string. However, the result yields the enum's int value instead of its name.

       //...
        typeAdapter.EnableJsonMapping();
        dynamic model = new JObject();
        model.enumValue = DomainEnum.Three;      
        var result = mapper.Map<string>(model);  // {  "enumValue": 2 }