zwwcn

Just another WordPress.com site

Category Archives: json

Json mapping exception:

Exception: Can not construct instance of abc.bcd.def.entity from String value ‘NONE’: value not one of declared Enum instance names

Solution: add @JsonCreator to the enum getter method.

	    @JsonCreator
	    public static InvestigatedBy fromName(String optionName) {
			if (optionName == null) {
				return null;
			}
			for (InvestigatedBy entry: InvestigatedBy.values()) {
				if (entry.getName().equals(optionName)) {
					return entry;
				}
			}
			return null;
		}

JsonMappingException: No suitable constructor found for type

You need a no-argument constructor for your entity