-1
I’m trying to deserialize three DTOS classes to export to a JSON file, I was able to do much of the process but when I try to export one class inside another I can’t.
follows the following scenarios:
public class TakeOffPoliciesDto {
private List<ExportTakeOffDto> exportTakeOffDto;
public List<ExportTakeOffDto> getExportTakeOffDto() {
return exportTakeOffDto;
}
public void setExportTakeOffDto(List<ExportTakeOffDto> exportTakeOffDto) {
this.exportTakeOffDto = exportTakeOffDto;
}
public class ExportTakeOffDto {
private List<FamilyTypeDto> familyTypeDtos;
private List<AirportPolicieDto> airportPolicieDtos;
public List<FamilyTypeDto> getFamilyTypeDtos() {
return familyTypeDtos;
}
public void setFamilyTypeDtos(List<FamilyTypeDto> familyTypeDtos) {
this.familyTypeDtos = familyTypeDtos;
}
public List<AirportPolicieDto> getAirportPolicieDtos() {
return airportPolicieDtos;
}
public void setAirportPolicieDtos(List<AirportPolicieDto> airportPolicieDtos) {
this.airportPolicieDtos = airportPolicieDtos;
}
private void exportToJSonFile() {
ObjectMapper objectMapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
TakeOffPoliciesDto takeOffPoliciesDto = new TakeOffPoliciesDto();
takeOffPoliciesDto.setExportTakeOffDto(Arrays.asList("1111", "9998887654", "1234567890"));
ExportTakeOffDto exportDto = new ExportTakeOffDto();
exportDto.setFamilyTypeDtos( Arrays.asList("8095185442", "9998887654", "1234567890"));
exportDto.setAirportPolicieDtos( Arrays.asList("8095185442", "9998887654", "1234567890"));
try {
objectMapper.writeValue(new File(file.getAbsolutePath(), "teste.json"), takeOffPoliciesDto);
} catch (JsonGenerationException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
What’s the matter?
– nullptr
When I try to deserialize one object within another it comes null ,
– CSS
And where is the Json of deserialization?
– nullptr
I’m trying to get this values straight from the Bank, I have a mode class, and I created a specific DTO for them
– CSS
And what is the bank’s data?
– nullptr