I have a big payload with different key property values. I tried creating model separate model classes based on the object on the portal. But there is no separate json object wrapped for such properties. My question is how to split the big json object into separate java classes.
Payload:
{
"documentType": "BDFFIIJCDSAAA",
"documentGroup": "394EIIJCDSAAA",
"ply": "0",
"numberOfCopies": "1",
"tpDocNumbers": [
"507317219"
],
"product": {
"vessel": null,
"voyage": null,
"countryOfReceipt": null,
"includeCountryOfReceipt": "true",
"countryOfLoading": null,
"includeCountryOfLoading": "true",
"countryOfDischarge": null,
"includeCountryOfDischarge": "true",
"iountryOfDelivery": null,
"includeCountryOfDelivery": "true",
"tradeLane": null,
"includeTradeLane": "true",
"placeOfReceipt": null,
"includePlaceOfReceipt": "true",
"loadPort": null,
"includeLoadPort": "true",
"dischargePort": null,
"includeDischargePort": "true",
"placeOfDelivery": null,
"includePlaceOfDelivery": "true"
},
"isTaskStatusBlank": "true",
"isTaskStatusOpen": "true",
"isTaskStatusClosed": "true",
"recepient": "Direct",
"recepientPort": null,
"communication": "Email",
"contact": "avinash.m@maersk.com",
"subject": "latest123",
"docBrokerDomain": "",
"printerName": "",
"templateDomain": "",
"priority": "",
"freeText": ""
}
Java Model classes -
public class A {
@JsonProperty("DocumentType")
private String documentType;
@JsonProperty("DocumentGroup")
private String documentGroup;
private Ply ply;
@JsonProperty("PartyRoles")
private String partyRoles;
@JsonProperty("CustomerId")
private String customerId;
@JsonProperty("PartyRoleTypeId")
private String partyRoleTypeId;
@JsonProperty("PartyRefNo")
private String partyRefNo;
@JsonProperty("TPDocNumbers")
private List<String> tpDocNumbers;
@JsonProperty("Product")
private Product product;
private Cargo cargoInfo;
private TaskCriteria taskCriteria;
private Recipient recipientInfo;
@JsonProperty("DocBrokerDomain")
private String docBrokerDomain;
@JsonProperty("PrinterName")
private String printerName;
@JsonProperty("TemplateDomain")
private String templateDomain;
@JsonProperty("Priority")
private String priority;
@JsonProperty("RequestType")
private String requestType;
@JsonProperty("FreeText")
private String freeText;
}
public class Ply {
@JsonProperty("Ply")
private int plyNumber;// plySelection
@JsonProperty("NumberOfCopies")
private int copies;// copySelection
@JsonProperty("freightSelection")
private String freightSelection;
}
This doesn't work and I get the error - "no String-argument constructor/factory method to deserialize from String value ('0')\n at" when it encounters the Ply Object class.