camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ychawla <premiergenerat...@yahoo.com>
Subject JSON - Jackson return list rather than POJO
Date Tue, 14 Aug 2012 18:27:02 GMT
Hello All,
I am unmarshalling data using Jackson.  My dataFormats bean is set up as
such:

        <dataFormats>
            <json id="personSearchJacksonID" library="Jackson"
unmarshalTypeName="model.PersonSearchResponse"/>
        </dataFormats>

However, my return value isn't a simple POJO, it is a list of POJO's.  For
example this is a sample stripped down JSON response:

[{"last_name":"xxxxxxx",,"first_name":"Heather"},{"last_name":"xxxxxxx","first_name":"Leah"}]

It returns a list of PersonSearchResponses rather than just a single
PersonSearchResponse.

In a JUnit test, I did this:

List<PersonSearchResponse> personSearchResponses =
mapper.readValue(inputFile, new
TypeReference<List&lt;PersonSearchResponse>>() { });

Is there an equivalent that I can do in the Spring DSL?  Worse comes worse,
I write a custom bean and pass the JSON response as the body and manually do
'mapper.readValue' and then process the list.

I am on Camel 2.8.4 so I am not using camel-xmljson and converting my POJO
to XML manually.

Thanks,
Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/JSON-Jackson-return-list-rather-than-POJO-tp5717341.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message