GSON:预期的BEGIN_OBJECT,但却是STRING
我收到一个GSON错误,试图将JSON解构到一个对象中。错误(预期BEGIN_OBJECT,但在第 3 行第 22 列处为 STRING)指向下面输入的第 3 行。
我是否没有针对 Bean 正确映射 JSON?
import javax.xml.bind.JAXBElement;
public class BusinessPartnerCreate {
protected JAXBElement<String> partnerType;
protected Person person;
protected Company company;
protected String email;
protected String phone;
protected AddressData addressData;
protected AddressClean addressClean;
protected String city;
protected String state;
protected String zipCode;
protected JAXBElement<String> externalId;
}
我的输入JSON看起来是这样的:
{
"business-partner-create": {
"partner-type": "1",
"person": {
"firstName": "Dirk",
"lastName": "Wintermill",
"title": ""
},
"email": "kirk@yahoo.com",
"phone": "219-385-2946",
"addressClean": {
"house-number": "10218",
"street-name": "Park",
"street-abbr": "Rd"
},
"city": "Somerset",
"state": "NJ",
"zip-code": "01955"
}
}