You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mike Oxford <mo...@gmail.com> on 2013/06/20 02:44:51 UTC

Jackson question... why does this fail?

        <dataFormats>
            <json id="jack" library="Jackson"/>
        </dataFormats>
...
        <route id="myRoute">
            <from ref="listener" />           // mina component
            <unmarshal ref="jack" />       // unmarshal it
            <marshal ref="jack" />          // marshal it
        </route>

I can put a bean:myBean in between and see that, yes, it is being
unmarshalled correctly.  Even more complex JSON will unmarshall correctly,
and I can traverse the returned Map.

{"a":5}             // input
[B@73207f36  // output

Why does the <marshal/> call return crap (an object ref of some kind?) even
for simple calls?

Thanks,

-mox

Re: Jackson question... why does this fail?

Posted by Christian Müller <ch...@gmail.com>.
I don't think it's crap. It's a byte array of your JSON string. Simple add
a convertBodyTo(String) to get a String.

Best,
Christian

Sent from a mobile device
Am 20.06.2013 02:45 schrieb "Mike Oxford" <mo...@gmail.com>:

>         <dataFormats>
>             <json id="jack" library="Jackson"/>
>         </dataFormats>
> ...
>         <route id="myRoute">
>             <from ref="listener" />           // mina component
>             <unmarshal ref="jack" />       // unmarshal it
>             <marshal ref="jack" />          // marshal it
>         </route>
>
> I can put a bean:myBean in between and see that, yes, it is being
> unmarshalled correctly.  Even more complex JSON will unmarshall correctly,
> and I can traverse the returned Map.
>
> {"a":5}             // input
> [B@73207f36  // output
>
> Why does the <marshal/> call return crap (an object ref of some kind?) even
> for simple calls?
>
> Thanks,
>
> -mox
>