users@jersey.java.net

[Jersey] Re: In JSON output how do you write a number as a number and not as a string?

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Fri, 17 Feb 2012 11:03:54 +0100

I'm confused. What is the setup where you see qoutes?

What is the setup where you don't see the quotes?

Marek

On 02/16/2012 10:26 PM, nbaliga wrote:
> I upgraded to Jackson 1.9.
>
> I am using Jersey 1.5.
>
> I have set up a Provider to provide a Jackson ObjectMapper instance that I
> have configured with the following property:
>
> /
> @Component
> @Provider
> public class JacksonObjectMapperProvider
> implements ContextResolver<ObjectMapper>
> {
> objectMapper.configure( JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS,
> false );
> ...
> }
> /
>
> I have also set up the initParam enabling the POJOMappingFeature in my
> web.xml
>
> I am now noticing that numbers are being serialized in JSON, with quotes.
>
> I tried a test case using the same ObjectMapper provider and the numbers get
> serialized without any quotes.
>
> This implies that Jackson is doing what it's supposed to when used on it's
> own, but somehow the Jersey + Jackson combination is causing numbers to be
> quoted.
>
> Any clues?
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/In-JSON-output-how-do-you-write-a-number-as-a-number-and-not-as-a-string-tp7292424p7292424.html
> Sent from the Jersey mailing list archive at Nabble.com.