2
我经历了Consuming a RESTful Web Service guide on the Spring website,但它没有讨论如何反序列化嵌套对象。例如,我将如何反序列化sample中的位置条目?如何使用Spring restTemplate反序列化嵌套的JSON
我经历了Consuming a RESTful Web Service guide on the Spring website,但它没有讨论如何反序列化嵌套对象。例如,我将如何反序列化sample中的位置条目?如何使用Spring restTemplate反序列化嵌套的JSON
您必须为位置数据创建一个域对象,该数据是顶层Page对象中的引用。以下是对这些课程的简要介绍。您需要正确注释对象以序列化/反序列化您想要的方式,并且根据您使用的标记框架,有许多关于如何执行此操作的示例。
public class Page {
String id;
String about;
...
Location location;
...
}
public class Location {
String street;
String city;
...
}
完美。谢谢。 –