How to serialize Enum types

Hi all,

I have the following situation:

In my project I have class that has enum as a field
Here is example

public class Company {

    private String companyName;

    private String address;

    private Country country; // Country is enum
   //...
}

Country enum looks like this

public enum Country {
    DE("Deutschland"),
    SE("Schweden"),
    DK("Dänemark"),
//...
    private String countryName;

    Country(String countryName) {
        this.countryName = countryName;
    }

    public String getCountryName() {
        return countryName;
    }
}

When I start camunda process in camunda cockpit when I inspect my company variable I see this

{"companyName":"CompanyName","address":"Street111",,"country":"DE"}

and for country I only see constant DE as string.
Is it possible to get country as object so I can access to countryName and show it in user task form?

Thanks in advance :slight_smile:

Hi @NNma,

as this is a general Java question, perhaps this blogpost helps you: https://www.baeldung.com/jackson-serialize-enums

Cheers, Ingo

@Ingo_Richtsmeier thanks :slight_smile: