映射REST json响应,该响应具有值而不是字段名

时间:2019-10-07 15:50:53

标签: java rest serialization model

我正在正确获得字符串形式的响应。但是,当我尝试将其建模到我的模型类时,我得到了所有的空值。如何使用值而不是字段名称反序列化JSON。

请让我知道我的模型课有什么错误。

我的Json回复:

{
  "186660214": {
    "conId": 186660214,
    "leNa": null,
    "leFormCd": null,
    "birthDa": "1957-01-26",
    "deathDa": null,
    "gndrCd": null,
    "gndrDesc": null,
    "mrtlStatCd": null,
    "annlIncmAmt": null,
    "conTyCd": "I",
    "actlRetrMth": null,
    "actlRetrYr": null,
    "birthIsoCtryCd": null,
    "birthYyyyDa": null,
    "emplrAdrTxt": "REMOVED BY SECURITY ",
    "emplrNa": "REMOVED BY SECURITY ",
    "empltInd": "Y",
    "esCityNa": null,
    "esAdmDivAbbrNa": null,
    "esIsoCtryCd": null,
    "estbDa": null,
    "induClassCd": "20 ",
    "keyRefSrceInd": null,
    "mrgeDa": null,
    "netWrthAmt": null,
    "occupGrpCd": "420",
    "retrInd": "N",
    "solForChrtyInd": null,
    "telCallPrfdCd": null,
    "usCaTaxTrtyInd": null,
    "emplCnt": null,
    "emplAvgAgeNo": null,
    "taxRtPct": null,
    "netIncmAmt": null,
    "totSalesAmt": null,
    "sboInd": null,
    "leFormTribalLawInd": null,
    "leChrtyInd": null,
    "ptnrshpEndDthPtnrInd": null,
    "fstGvnNa": "Unguja",
    "midGvnNa": null,
    "mainFamNa": "Jeon",
    "conPrfdFstNa": null,
    "alphaDsplyNa": "Jeon, Unguja ",
    "alphaSortNa": "JEON                UNGUJA     ",
    "sltnCd": null,
    "sltnDesc": null,
    "snrtySufxCd": null,
    "snrtySufxDesc": null,
    "callPrmsnInd": false,
    "callPrmsnAsked": false,
    "revsnUt": "2016-02-08-06.04.23.319338",
    "taxInfo": {
      "tinTyCd": "S",
      "tinNo": "962000000"
        }
    }
}

模型类

公共类联系人{

@JsonProperty("")
@JsonInclude(Include.NON_NULL)
private List<Contact> contactId;

@ApiModelProperty(value="Contact identifier")
private Long conId;

@ApiModelProperty(value="Contact legal entity name")
private String leNa;

@ApiModelProperty(value="Contact legal entity form code")
private String leFormCd;

@ApiModelProperty(value="Contact birth date")
private LocalDate birthDa;

@ApiModelProperty(value="Contact death date")
private LocalDate deathDa;

@ApiModelProperty(value="Contact gender code")
private String gndrCd;

@ApiModelProperty(value="Contact gender description")
private String gndrDesc;

@ApiModelProperty(value="Contact marital status code")
private String mrtlStatCd;

@ApiModelProperty(value="Contact annual income")
private Integer annlIncmAmt;

@NotBlank(message="contact type code is mandatory")
@Pattern(regexp="^[IL]{1}",message="invalid contact type code")  
@ApiModelProperty(value="Contact type code (I)ndividual, (L)egal entity")
private String conTyCd;

private Integer actlRetrMth;

private Integer actlRetrYr;

private String birthIsoCtryCd;

private Integer birthYyyyDa;

private String emplrAdrTxt;

private String emplrNa;

private String empltInd;

private String esCityNa;

private String esAdmDivAbbrNa;

private String esIsoCtryCd;

private LocalDate estbDa;

private String induClassCd;

private String keyRefSrceInd;

private LocalDate mrgeDa;

private Integer netWrthAmt;

private String occupGrpCd;

private String retrInd;

private String solForChrtyInd;

private String telCallPrfdCd;

private String usCaTaxTrtyInd;

private Integer emplCnt;

private Integer emplAvgAgeNo;

private Double taxRtPct;

private Integer netIncmAmt;

private Integer totSalesAmt;

private String sboInd;

private String leFormTribalLawInd;

private String leChrtyInd;


private String ptnrshpEndDthPtnrInd;

@NotBlank(message="first name is mandatory")
@ApiModelProperty(value="Contact first name")
private String fstGvnNa;

@ApiModelProperty(value="Contact middle name")
private String midGvnNa;

@NotBlank(message="last name is mandatory")
@ApiModelProperty(value="Contact last name")
private String mainFamNa;

@ApiModelProperty(value="Contact preferred first name")
private String conPrfdFstNa;

@ApiModelProperty(value="Contact name used for display purposes")
private String alphaDsplyNa;

@ApiModelProperty(value="Contact name used for sorting in contact search system")
private String alphaSortNa;

@ApiModelProperty(value="Contact salutation code")
private String sltnCd;

@ApiModelProperty(value="Contact salutation description")
private String sltnDesc;

@ApiModelProperty(value="Contact senority suffix code")
private String snrtySufxCd;

@ApiModelProperty(value="Contact senority suffix description")
private String snrtySufxDesc;



@ApiModelProperty(value="Contact call permission indicator (for prospects)")
private boolean callPrmsnInd;

@ApiModelProperty(value="Contact call permission 'asked' indicator (for prospects)")
private boolean callPrmsnAsked;



@ApiModelProperty(value="Revision timestamp (in UTC) from 122257")
private String revsnUt;

@ApiModelProperty(value="Contact taxinformation")
private TaxInfo taxInfo;


}

0 个答案:

没有答案