I am trying to retrieve OneToMany association in my spring boot project.When I am returning the JSON response from controller it is only getting like normal list of string instead of proper JSON. This result is a join result from a JPQL query,
I am adding the repository method here,
@Query("SELECT ur.userId , r.role FROM Roles r JOIN r.roleJoin ur")
List<Roles> findByRole();
And my controller has the code like the following,
@GetMapping("/check")
public List<Roles> check() {
return repoObj.findByRole();
}
And getting response like this,
[[2,"A"],[649,"B"],[651,"C"],[653,"A"],[658,"A"],[3,"A"],[1,"B"],[670,"B"]]
It is seemd to be a list of object, But defaultly spring boot controller will return the data in JSON format. But I only getting like the following. Since I need to access the JSON from my front end Angular application.
Can anyone help me to clarify that to send response in proper JSON itself instead of just a list ?