Spring Boot @jsoncomponent example: 2018

Опубликовано: 13 Ноябрь 2018
на канале: Learning and Teaching
1,111
7

Let's understand what is the need of @Jsoncomponent annotation in this video.
So, the question is how to customize the JSON serialize and deserialize in Spring Boot application.

Internally, Spring Boot uses Jackson library for object to json conversion. When do we need to customize the json?
We have used java.time.Instant instance so when spring converts into JSON default format it will look like:
{
"no": 1,
"name": "Scott",
"designation": "Manager",
"gender": "Male",
"instant": {
"epochSecond": 2232150600,
"nano": 626000000
}

In this json instant is not in a readable format. We should send date to readable format.
But Jackson is not providing support for all the type of object
In this example, We have used java.time.Instant and convert to yyyy-MM-dd HH:mm:ss readable format using @JsonComponent


На этой странице сайта вы можете посмотреть видео онлайн Spring Boot @jsoncomponent example: 2018 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Learning and Teaching 13 Ноябрь 2018, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,111 раз и оно понравилось 7 зрителям. Приятного просмотра!