On Wed, Nov 11, 2009 at 10:26:15AM +0100, Tom Schindl wrote:
> Hi Jakub and Tatu,
>
> Jakub Podlesak schrieb:
> > On Tue, Nov 10, 2009 at 05:13:18PM -0800, Tatu Saloranta wrote:
> >> On Tue, Nov 10, 2009 at 11:11 AM, Tom Schindl
> >> <tom.schindl_at_bestsolution.at> wrote:
> >>> Hi,
> >>>
> >>> I'm running into a problem with the Jersey-JSON serialization because I
> >>> need to satisfy an API which require me to serialize empty Collections.
> >>>
> >>> The external party requires me to send JSON in the following format:
> >>>
> >>> --------8<--------
> >>> {
> >>> a : "Blabla",
> >>> l : []
> >>> }
> >>> --------8<--------
> >>>
> >>> but it looks like this is not possible to achieve with jersey because if
> >>> the l-attribute holds an empty list or null it is not part of the
> >>> serialized response:
> >> I let others explain if and how this is possible with JAXB and bundled
> >> json handlers, but I will add the usual comment that
> >
> > Unless you wanted to use the low-level JSON approach and JSONArray/JSONObject
> > classes, you would indeed need to leverage the JacksonJsonProvider as suggested by Tatu.
>
> Thanks. Just included the JacksonJsonProvider into my application and it
> looks good so far. Would it be possible at all to bring in such a
Great!
> support to jersey itself?
Are you asking if this should work as a default behaviour for Jersey, or are you looking
for a more comfortable way how to bring JacksonJsonProvider in in terms of maven dependency
definition within Jersey?
At the moment we are retaining the default JSON configuration mainly for backward compatibility
reasons.
~Jakub
>
> If yes I'd try provide you a patch for it but before I start searching
> through the code I'd like to know if this is even possible at or a
> limitation of underlying infrastructure.
>
> Tom
>
> --
> B e s t S o l u t i o n . a t EDV Systemhaus GmbH
> ------------------------------------------------------------------------
> tom schindl geschaeftsfuehrer/CEO
> ------------------------------------------------------------------------
> eduard-bodem-gasse 5/1 A-6020 innsbruck phone ++43 512 935834
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
--
Jakub Podlešák
Software Engineer at SUN Microsystems And CZJUG Co-Leader
http://blogs.sun.com/japod