users@jersey.java.net

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

From: Rob - <skyscrapper666_at_hotmail.com>
Date: Tue, 27 Apr 2010 13:37:39 +1030

No, I haven't used a custom writer, just Jersey out of the box. I guess then I found a bug...

 

The Jackson output makes sense to me, I'll give it a go and keep you guys posted.
 


Date: Fri, 23 Apr 2010 07:57:59 +0200
From: Jakub.Podlesak_at_Sun.COM
To: users_at_jersey.dev.java.net
Subject: Re: [Jersey] Jersey, Json, WCF and Maps

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?
                                               
_________________________________________________________________
If It Exists, You'll Find it on SEEK. Australia's #1 job site
http://clk.atdmt.com/NMN/go/157639755/direct/01/