Personal I have the following record being returned by a query using SpringData
:
page = grupoService.findByNomeStartingWithOrderByNomeAsc(2, pageable);
If I run the following code:
System.out.println(page.getContent().get(0));
It prints:
Grupo{id=2, dtOperacao='2016-08-26'}
But when I convert to JSON
(to be sent to frontend
):
return new ResponseEntity<String>(new Gson().toJson(scSelect), headers, HttpStatus.OK);
It even converts the date to:
{"id": 1, "dtOperacao":{"year":2016,"month":8,"day":26}}
It should however return like this:
dtOperacao='2016-08-26'
Does anyone know how to solve this? Remember that I need to continue using Gson
.