Sunday, 15 January 2012

java - Jackson unable to Map Class using ObjectMapper -


I am trying to serialize a square with a map of two strings and strings using Jackson. Here's Jason, I'm trying to serialize. I am thinking that there is a problem because I want to serial the empty array series. {"Test": ["hi"], "group": [], "group": [], "chain": [], "chainshot" : [], "Location": [], "location of place": [], "report": [], "reports": []}, "date from": "09.03.2015", "toDate": "16.03.2015"}

Here is a class that is being used to use and sort it.

  Public Category FilterRequest {public string getToDate () {back to; } Public Zero Settud (String Tundet) {this.toDate = toDate; } Public string getFromDate () {Return from date; } Public Zero setformat (string sendet) {this.fromDate = fromDate; } Public Map & lt; String, string []> GetFilters () {Return Filter; } Public Zero Set Filter (Map & lt; String, String [] & gt; Filters) {this.filters = filters; } Private string toddade; Private string sender; Private map & lt; String, string []> Filter; Public Filter Request () {Filters = New Hashmap & lt; String, string []> (); }}  

The code that is failing is simply

  object mapper mapper = new objectmap (); FilterRequest request mercury = mapper.readValue (requestBody, FilterRequest.class);  

I'm getting the error

  No suitable constructor for type [General Type, class com.aramburu.overall.web.controller. FilterController $ [Source: {"filter": ["hi"], "group": [], "groupsOT": Instant to JSON object (need to add / enable information type?) "]": [], "Chainsot": [], "location": [], "placesOT": [], "report": [], "reportsot": []}, "FromDate": "09.03.2015" "todate": "2015/03/16"}; Line: 1, column: 2]  

Output: is not a suitable manufacturer [Simple type, class com.aramburu.overall.web.controller.filterController $ FilterRequest found for the type that means FilterRequest is an internal range.

Make FilterRequest class static (or - better still - remove it from FilterController ).


No comments:

Post a Comment