My code is as below
@Data
@Document(collection = "models")
public class Model {
@Field(value = "modelDt")
private LocalDateTime modelDate;
}
@Data
public class ModelDTO {
private LocalDateTime modelDate;
}
@RestController
@RequestMapping("/api/v1/model")
public class ModelController {
@Autowired
ModelService modelService;
@GetMapping
public List<ModelDTO> getModels() {
return modelService.getAllModels();
}
}
Used this almost everywhere where the JSON response is coming as a proper format like yyyy-mm-ddT00:00:00 , but in the above case I'm getting the date in the below format.
[
{
"modelDate": [
YYYY,
MM,
DD,
00,
00,
0000
]
}
]
I've crossed checked my code with the ones where the proper format is being returned.