Jackson always had an error parsing the returned JSON string, and it was a long time before the reason was found because the letters in the JSON string were capitalized, causing Jackson to not find the key.
The data obtained from the server is often used in the project, and sometimes the first letter in the JSON string obtained from the server is capitalized, and the use of Jackson parsing is to report the error:
Exception in thread "main" org.codehaus.jackson.map.exc.UnrecognizedPropertyException:Unrecognized Field "XXX" (Class xxxx), not marked as ignorable.
The exception information tells that the XXX attribute field is not found in type XXX and is not marked as ignored.
But this field does exist in your bean, except that the first letter of the field is capitalized.
To solve this problem, you only need to add @jsonproperty () to the attribute field.
1 Public classCommissionitemvoImplementsserializable{2 3 /**4 * 5 */6 Private Static Final LongSerialversionuid = 1L;7 8 Private intdocId;9@JsonProperty ("CName")Ten PrivateString CName; One@JsonProperty ("Cphone") A PrivateString Cphone; -@JsonProperty ("Blockname") - PrivateString Blockname; the@JsonProperty ("Seetime") - PrivateString seetime; -@JsonProperty ("Cost") - PrivateString cost; +@JsonProperty ("Endsettletime") - PrivateString endsettletime; + A Public intgetdocid () { at returndocId; - } - - - - Public voidSetdocid (intdocId) { in This. DocId =docId; - } to + - the PublicString Getcname () { * returnCName; $ }Panax Notoginseng - the + Public voidsetcname (String cName) { ACName =CName; the } + - $ $ PublicString Getcphone () { - returnCphone; - } the - Wuyi the Public voidSetcphone (String cphone) { -Cphone =Cphone; Wu } - About $ - PublicString Getblockname () { - returnBlockname; - } A + the - Public voidsetblockname (String blockname) { $Blockname =Blockname; the } the the the - PublicString Getseetime () { in returnSeetime; the } the About the the Public voidsetseetime (String seetime) { theSeetime =Seetime; + } - the Bayi the PublicString Getcost () { the returnCost ; - } - the the the Public voidsetcost (String cost) { theCost =Cost ; - } the the the 94 PublicString Getendsettletime () { the returnEndsettletime; the } the 98 About - Public voidsetendsettletime (String endsettletime) {101Endsettletime =Endsettletime;102 }103 104 the 106 Public Static LongGetserialversionuid () {107 returnSerialversionuid;108 }109 the 111 the @Override113 PublicString toString () { the return"Commissionitemvo [docid=" + DocId + ", cname=" + CName + ", cphone=" + Cphone + ", blockname=" + Blockname + ", seetime=" + Seetime + ", cost=" + Cost + ", endsettletime=" + Endsettletime + "]"; the } the 117 118 119}
Use Jackson to parse the first uppercase JSON string