Reputation: 91
I went through the Consuming a RESTful Web Service guide on the Spring website, but it doesn't talk about how to deserialize nested objects. For example, how would I deserialize the location entry in the sample?
Upvotes: 2
Views: 2421
Reputation: 156
You have to create a domain object for the Location data that is a reference in the top-level Page object. Below is an overly simplified look at the classes. You'll need to properly annotate the objects to serialize/deserialize how you want it to and there are numerous examples on how to do that depending on what markup framework you use.
public class Page {
String id;
String about;
...
Location location;
...
}
public class Location {
String street;
String city;
...
}
Upvotes: 2