I am trying to Convert following POJO to a JSON in @RestController:
@Entity
@Table(name=\"user_location\")
@NamedQuery(name=\"UserLocation.findA
First remove that annotations from your State.java and City.java
@JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class, property="@id", scope = State.class)
@JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class, property="@id", scope = City.class)
No need of these annotations and in RestController add return type as @ResponseBody UserLocation . It will give you json of that class.