I am making a request from the site API swapi and whenever I do the conversion from JSON to POJO, I get the NULL return
RestTemplate restTemplate = new RestTemplate();
String fooResourceUrl = "https://swapi.co/api/planets/?format=json";
PlanetaEntity response = restTemplate.getForObject(fooResourceUrl, PlanetaEntity.class);
But when there is no conversion, I already direct to String, the return is not null.
RestTemplate restTemplate = new RestTemplate();
String fooResourceUrl = "https://swapi.co/api/planets/?format=json";
String response = restTemplate.getForObject(fooResourceUrl, String.class);
I believe there is a problem in my PlanetaEntity class, but I have not yet been able to identify it.
@JsonIgnoreProperties(ignoreUnknown = true)
@Document(collection = "starwars")
public class PlanetaEntity implements Serializable {
private static final long serialVersionUID = -8511702512631671990L;
@Id
private ObjectId _id;
private String name;
private String climate;
private String terrain;
private List<String> films
// Getters e Setters
Remembering that I'm using MongoDB for database.