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> 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.



-- 
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

Reply via email to