You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Martin Gilday <ma...@imap.cc> on 2009/05/31 13:59:58 UTC

JSON DataFormat using Jackson

Hi,

I've created CAMEL-1664 which is a DataFormat for JSON using the Jackson
library.  I have been using this library in production where I work
using Converters, but would quite like to be able to use the clearer DSL
methods .marshal().json()., as well as it hopefully being useful to
other camel users.

If the contribution is accepted I have noted a potential issue with the
DSL.  As there is already a data format for JSON using XStream the DSL
would need to know which implementation the user would like.  At first I
thought it could simply detect which dependency you had (either
camel-xstream or camel-jackson), but then this precludes using xstream
for xml and jackon for json. The first solutions that came to mind are:
* Add a new method .marhsal.jackson() -- a little confusing as users may
not know what jackson is
* Add an enum to choose e.g .marshal.json(JsonTypes.JACKSON) -- would
need to choose a default impl
Any other suggestions?

Martin.

Re: JSON DataFormat using Jackson

Posted by Willem Jiang <wi...@gmail.com>.
+1 for using the enum to select the impl.

Willem

Claus Ibsen wrote:
> Hi Martin
> 
> Great work. Could you post a link to this thread in the JIRA using eg
> a nabble link?
> And post your questions on the JIRA. Then we wont forget to look into
> this when we get the time to add your patch.
> 
> The idea with an enum to select the impl. is good, as we can JAXB it
> so its selectable from spring DSL as well.
> It should probably default to the current impl.
> 
> 
> On Sun, May 31, 2009 at 1:59 PM, Martin Gilday <ma...@imap.cc> wrote:
>> Hi,
>>
>> I've created CAMEL-1664 which is a DataFormat for JSON using the Jackson
>> library.  I have been using this library in production where I work
>> using Converters, but would quite like to be able to use the clearer DSL
>> methods .marshal().json()., as well as it hopefully being useful to
>> other camel users.
>>
>> If the contribution is accepted I have noted a potential issue with the
>> DSL.  As there is already a data format for JSON using XStream the DSL
>> would need to know which implementation the user would like.  At first I
>> thought it could simply detect which dependency you had (either
>> camel-xstream or camel-jackson), but then this precludes using xstream
>> for xml and jackon for json. The first solutions that came to mind are:
>> * Add a new method .marhsal.jackson() -- a little confusing as users may
>> not know what jackson is
>> * Add an enum to choose e.g .marshal.json(JsonTypes.JACKSON) -- would
>> need to choose a default impl
>> Any other suggestions?
>>
>> Martin.
>>
> 
> 
> 


Re: JSON DataFormat using Jackson

Posted by Claus Ibsen <cl...@gmail.com>.
Hi Martin

Great work. Could you post a link to this thread in the JIRA using eg
a nabble link?
And post your questions on the JIRA. Then we wont forget to look into
this when we get the time to add your patch.

The idea with an enum to select the impl. is good, as we can JAXB it
so its selectable from spring DSL as well.
It should probably default to the current impl.


On Sun, May 31, 2009 at 1:59 PM, Martin Gilday <ma...@imap.cc> wrote:
> Hi,
>
> I've created CAMEL-1664 which is a DataFormat for JSON using the Jackson
> library.  I have been using this library in production where I work
> using Converters, but would quite like to be able to use the clearer DSL
> methods .marshal().json()., as well as it hopefully being useful to
> other camel users.
>
> If the contribution is accepted I have noted a potential issue with the
> DSL.  As there is already a data format for JSON using XStream the DSL
> would need to know which implementation the user would like.  At first I
> thought it could simply detect which dependency you had (either
> camel-xstream or camel-jackson), but then this precludes using xstream
> for xml and jackon for json. The first solutions that came to mind are:
> * Add a new method .marhsal.jackson() -- a little confusing as users may
> not know what jackson is
> * Add an enum to choose e.g .marshal.json(JsonTypes.JACKSON) -- would
> need to choose a default impl
> Any other suggestions?
>
> Martin.
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus