I have following class
public class Employee {
@JsonPropery("name")
private String name;
@JsonPropery("address")
private Address address;
// getter setters
}
And
public class Address {
@JsonPropery("street")
private String name;
@JsonPropery("location")
private String name;
// getter setters
}
Now while generating the JSON for this model, following error is obtained:
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:251)
at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:183)
Can you Please help out in what should be used in place of @JsonProperty
here.
If the referenced class is removed , Proper JSON is obtained. Is there any specific annotation to be used for class reference ?