I am getting a GSON error trying to unmarshal JSON into an object. The error (Expected BEGIN_OBJECT but was STRING at line 3 column 22) is pointing to line 3 of the input below.
Have I not mapped the JSON correctly with respect to the Bean?
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;
}
And my input JSON looks is this:
{
"business-partner-create": {
"partner-type": "1",
"person": {
"firstName": "Dirk",
"lastName": "Wintermill",
"title": ""
},
"email": "[email protected]",
"phone": "219-385-2946",
"addressClean": {
"house-number": "10218",
"street-name": "Park",
"street-abbr": "Rd"
},
"city": "Somerset",
"state": "NJ",
"zip-code": "01955"
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…