Hi Better late than newer. I have logged a ticket so we wont forget about this https://issues.apache.org/jira/browse/CAMEL-5604
On Thu, Aug 23, 2012 at 9:01 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > On Mon, Aug 20, 2012 at 10:42 AM, Jason Chaffee > <jason.chaf...@betfair.com> wrote: >> I asked this same question before and this the example and answer I got >> about using a Map with Jackson. >> > > Yeah I think it uses Map by default. > >> >> <dataFormats> >> <!-- here we define a Json data format with the id jack and that it >> should use the TestPojo as the class type when >> doing unmarshal. The unmarshalTypeName is optional, if not >> provided Camel will use a Map as the type --> >> <json id="jack" library="Jackson" >> unmarshalTypeName="org.apache.camel.component.jackson.TestPojo"/> >> </dataFormats> >> >> I did not test it to confirm that it works correctly though. >> >> On Aug 20, 2012, at 1:08 AM, Claus Ibsen >> <claus.ib...@gmail.com<mailto:claus.ib...@gmail.com>> wrote: >> >> Hi >> >> Maybe we could improve the camel-jackson to support list/map types as >> responses more easily? >> I just wonder what a good solution would be? >> >> Either the user would need to explicit configure this on the data format? >> >> Or we can look into a fallback type converter, so Camel automatic an >> convert to a List/Map for you. >> And if you want you can use >> >> <convertBodyTo type="java.util.List"/> >> >> And then the fallback type converter would kick in. >> >> >> >> On Tue, Aug 14, 2012 at 9:43 PM, ychawla >> <premiergenerat...@yahoo.com<mailto:premiergenerat...@yahoo.com>> wrote: >> A simple workaround for this is a custom bean processor like so: >> >> public void processPersonSearchResponseJSON(Exchange exchange) throws >> JsonParseException, JsonMappingException, IOException >> { >> ObjectMapper mapper = new ObjectMapper(); >> >> List<PersonSearchResponse> personSearchResponses = >> mapper.readValue(exchange.getIn().getBody(String.class), new >> TypeReference<List<PersonSearchResponse>>() { }); >> >> exchange.getIn().setBody(personSearchResponses); >> >> } >> >> and in the camel context: >> >> <camel:to uri="JSONEndpoint"/> >> >> <camel:convertBodyTo type="java.lang.String"/> >> >> <camel:log message="This is the JSON Response: ${body}" /> >> >> <camel:to >> uri="bean:personSearchResponseJSONProcessor?method=processPersonSearchResponseJSON"/> >> >> >> >> >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/JSON-Jackson-return-list-rather-than-POJO-tp5717341p5717347.html >> Sent from the Camel - Users mailing list archive at >> Nabble.com<http://Nabble.com>. >> >> >> >> -- >> Claus Ibsen >> ----------------- >> FuseSource >> Email: cib...@fusesource.com<mailto:cib...@fusesource.com> >> Web: http://fusesource.com >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.com >> Author of Camel in Action: http://www.manning.com/ibsen >> >> >> ________________________________________________________________________ >> In order to protect our email recipients, Betfair Group use SkyScan from >> MessageLabs to scan all Incoming and Outgoing mail for viruses. >> >> ________________________________________________________________________ > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen