我正在使用spring和REST API。目前我正在尝试使用第三方REST API,它具有可以是数组或单个对象的属性。我不知道如何处理RESTTemplate尝试将单个对象映射到数组的情况。我尝试考虑CustomSerializer,但想到询问是否还有其他功能可用于此。
响应可以低于{
searchBusinessUnitsDetailsResponse: {
responseMessage: {
code: "SUCCESS"
description: "SUCCESS"
}-
businessUnitDetails: {
name: "MCDONOUGH, GA"
number: "3201"
或
{
searchBusinessUnitsDetailsResponse: {
responseMessage: {
code: "SUCCESS"
description: "SUCCESS"
}-
businessUnitDetails: [2]
0: {
name: "PQR, AR"
number: "XZY"},1:{name:"abc, GA", number:"LMN"}}
此致