Hello Pontus thanks... yes after fiddling for a while i figured out that the best way was to use a <marshal ref="jsonDataFormat"/>
everything works as expected now thanks again for ur help w/kindest regards marco On Sat, Sep 1, 2012 at 4:42 PM, Pontus Ullgren <ullg...@gmail.com> wrote: > Hello Marco, > > When I reread you post I saw that you have a Json marshal as a > separate filter in your route. In that case your processor should > probably just set the node object in the body and let the marshal > component create the Json. > ---------- > ObjectMapper mapper = new ObjectMapper(); > ObjectNode node = mapper.createObjectNode(); > > node.put("ticker" , item.getShare().getTicker()); > node.put("name", item.getShare().getName()); > node.put("price", item.getShare().getPrice()); > node.put("latest", item.getLatestPrice().getLatestPrice()); > > if(ptfData != null) { > exchange.getOut().setBody(node); > } > ---------- > > // Pontus > > > > On Sat, Sep 1, 2012 at 1:35 PM, Marco Mistroni <mmistr...@gmail.com> > wrote: > > thanks a lot Pontus! > > > > w/kindest regards > > marco > > > > On Sat, Sep 1, 2012 at 9:05 AM, Pontus Ullgren <ullg...@gmail.com> > wrote: > > > >> Hello, > >> > >> You don't use the Jackson api correctly. You should use one of the > >> writeValue methods to extract the json. > >> Best regards > >> Pontus Ullgren > >> > >> Send from my phone > >> Den 1 sep 2012 00:02 skrev "Marco Mistroni" <mmistr...@gmail.com>: > >> > >> > HI all > >> > i have a Jetty-Json route in my camel-app > >> > > >> > i submit JSON via python client, and i should return JSON back. > >> > > >> > i am using this configuration: > >> > > >> > <camel:route id="Jetty_Sample"> > >> > <camel:from uri="jetty: > http://localhost:8888/myJettyService" > >> > /> > >> > <!-- camel:log logName="HTTP LOG" loggingLevel="INFO" > >> > message="HTTP REQUEST: > >> > ${in.header.bookid}" / --> > >> > <camel:process ref="myJettyService" /> > >> > <camel:marshal ref="jsonFormatter" /> > >> > </camel:route> > >> > > >> > <bean id="jsonFormatter" > >> > class="org.apache.camel.model.dataformat.JsonDataFormat"> > >> > <property name="library" value="Jackson" /> > >> > </bean> > >> > > >> > > >> > THe problem i have is the bean 'myJettyService' is returning a > 'complex' > >> > POJO which is not being marshalled correcly (here's output of my > python > >> > json client) > >> > org.codehaus.jackson.map.ObjectMapper@11167f3 > >> > > >> > instead of a json string > >> > > >> > here's my java code in the processor > >> > > >> > ObjectMapper mapper = new ObjectMapper(); > >> > ObjectNode node = mapper.createObjectNode(); > >> > > >> > node.put("ticker" , item.getShare().getTicker()); > >> > node.put("name", item.getShare().getName()); > >> > node.put("price", item.getShare().getPrice()); > >> > node.put("latest", item.getLatestPrice().getLatestPrice()); > >> > > >> > > >> > > >> > if(ptfData != null) { > >> > exchange.getOut().setBody(mapper.toString()); > >> > > >> > Clearly , i am missing something because my ObjectMapper just get > >> > marshalled into this > >> > org.codehaus.jackson.map.ObjectMapper@11167f3 > >> > > >> > instead of > >> > > >> > {'ticker': 'myticker', 'name': 'shareName' .... } > >> > > >> > could anyone tell me what am i missing? > >> > > >> > w/kindest regards > >> > marco > >> > > >> >