users@jersey.java.net

Re: [Jersey] Jersey, Json, WCF and Maps

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Fri, 23 Apr 2010 07:57:59 +0200

Rob - wrote:
> Please see in-line....
>
> You say:
>
> {Map:{"entry",{"key":"key1","value":"value1"},"entry",{"key":"key2","value":"value2"},"entry","key":"key3","value":"value3"}.....}}
>
> This is not a valid JSON, the Map is not quoted, then after the
> first "entry", there should be a colon instead of the comma, etc.
>
> -->> Yes, a typo from my side. The actual JSON is the following:
>
> [{"map":{"entry":{"key":"A","value":"A"},"entry":{"key":"C","value":"C"}}}]
This is also a bit weird as there are the two "entry"s in the JSON
object, maybe you meant:

{"map":[{"entry":{...}},{"entry":{...}}]}

but it depends, how you get this. Have you used any Jersey provided
writer?? If so, this is a bug.
Could you please confirm?

>
> What would the output from Jackson be like for a Map<String,String> ?

{"A":"A","C":"C"}

~Jakub
>
>
>
>
> ------------------------------------------------------------------------
> Find it at CarPoint.com.au New, Used, Demo, Dealer or Private?
> <http://clk.atdmt.com/NMN/go/206222968/direct/01/>