January 2018
Intermediate to advanced
414 pages
10h 29m
English
This is how it works when a complex object is sent, for example, with this request:
curl -X POST \ http://localhost:8080/customer/ \ -H 'content-type: application/json' \ -d ' { "id": 4, "name": "New Customer", "telephone": { "countryCode": "+44", "telephoneNumber": "7123456789" } }'
When the ObjectMapper explores the class that we ask to deserialize from JSON into a java object, it will explore as well any other class that it uses. JSON, when it is analyzing the Customer class and finding the attribute telephone, will get the Telephone class and explore the getters and setters for this class as well.
So, when reading the JSON and finding the attribute telephone, it will use the Telephone class to create the ...
Read now
Unlock full access