I have an entity which looks like this (I'll omit getters, setters and constuctors for the sake of brevity):
@Entity
public class System {
@NotNull
@Column(name = "SYSTEMID", nullable = false)
@Embedded
private SystemId systemId;
}
with SystemId looking like this:
@Embeddable
@JsonSerialize(using = SystemIdSerializer.class)
@JsonDeserialize(using = SystemIdDeserializer.class)
public class SystemId {
@Column(name = "SYSTEMID", nullable = false)
private String value;
}
My custom serializer does nothing but write out value, which works for 'normal' JSON, just not the HAL representation which looks like this:
{
"systemId": {
"content": "1"
}
}
I would like to have it like this
{
"systemId": "1"
}
as well. Is there any way to do it? I've spent some time googling but wasn't successful. Thanks.