I've created a basic Spring Boot application with Restful services using CrudRepository
to interact with the DB.
The JSON response contains "_embedded" : { ... }
and "_links" : { ... }
which I don't want.
{
"_embedded" : {
"countries" : [
{
"name" : "Antarctica",
"_links" : {
"self" : {
"href" : "http://localhost:8080/world/rest/countries/ATA"
},
"country" : {
"href" : "http://localhost:8080/world/rest/countries/ATA"
}
}
},
...
]
}
How can I get rid of this structure and return my objects in a simple list? Is there some property or configuration that can be set to remove this from all responses?
I've added the property spring.hateoas.use-hal-as-default-json-media-type=false
, didn't work.
Tried converting the result to a list manually, countries.forEach(countriesList::add);
; no luck..
POJO Class to map objects
/* Package and Imports */
@Entity(name = "country")
public class Country {
@Id
private String code;
private String name;
private String continent;
private String region;
/* Getters, Setters and equals method below */
}