I have an object that is related to a set of other objects.  I suppose I could 
make 2 maps both keyed by the same primitive, one for the objects, and one to 
the related objects.  But why?  You say it is not a good idea, but my objects 
all implement hashcode and equals, and outside of trying to transform the 
structure to json, it works perfectly.  Is there some json limitation with 
having object keys?  Looking at the transformer in the plugin, it seems to 
handle object keys just fine.


Brian Relph

-----Original Message-----
From: Musachy Barroso [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 11, 2008 6:42 PM
To: Struts Users Mailing List
Subject: Re: [S2] JSON plugin parser error

Using objects as keys is probably not a good idea.

musachy

On Tue, Nov 11, 2008 at 6:25 PM, Relph,Brian <[EMAIL PROTECTED]> wrote:

>
> Hello,  I am trying to use the JSON plugin in my struts2 application.  
> I am getting a parser error on the string returned from the server.  I 
> think the plugin is having problems converting my Map to JSON.
>
> Here is my object that I am trying to convert to JSON:
>
> *public** class** RoleDetails** extends* RoleImpl {
>
>        * private* List<Role> directParents;
>
>        * private* Map<Role, Set<Identity>> 
> transitiveParentsWithSources;
>
>        * private* List<Role> directChildren;
>
>        * private* Map<Role, Set<Identity>> 
> transitiveChildrenWithSources;
>
>        * private* List<Group> directGroupChildren;
>
>        * private* Map<Group, Set<Identity>> 
> transitiveGroupChildrenWithSources;
>
>        * private* List<String> directUsernames;
>
>        * private* Map<String, Set<Identity>> 
> transitiveUsernamesWithSources;
>
>        * private* List<Permission> directPermissionParents;
>
>        * private* Map<Permission, Set<Identity>> 
> transitivePermissionParentsWithSources;
>
> I have attached the output from one of my requests, but it is pretty 
> long, here is the portion where the json compiler explodes:
>
> <<json.txt>>
>
> "transitiveChildrenWithSources":{},"transitiveGroupChildrenWithSources
> ":*ERROR
> HERE*{{"description":"super
> users","groupNames":[],"name":"hin_wasadmins","usernames":["ar016581",
> "temp_wasadmin","admin_usertool","relphie","bgraves","newtestuser","fk
> 3794","samkarl","test_usertool","kp016678","bo017459","bk016677","rw01
> 2795","kchintan","kp014672"]}:[{"description":"Health
> Management
> Advisor","groupNames":["hin_wasadmins"],"name":"HHM_Advisor","username
> s":["testuser13","kp016678","hmadvisor1","hmadvisor2_cert","hmadvisor1
> _cert","hmadvisor2","hmadvisor3","hmadvsr2","hmadvisor3_cert","hmadvsr
> 1","hmadvsr3"]}]}
>
> So it looks like there is either a problem with my map keyed by 
> object, or the transitiveChildrenWithSources map being empty.  Any thoughts?
>
> *Brian Relph* | Software Engineer | Cerner Corporation | 816-201-7642 
> | **
> [EMAIL PROTECTED] <[EMAIL PROTECTED]> | 
> ***www.cerner.com*<http://www.cerner.com>
> ------------------------------
> CONFIDENTIALITY NOTICE This message and any included attachments are 
> from Cerner Corporation and are intended only for the addressee. The 
> information contained in this message is confidential and may 
> constitute inside or non-public information under international, 
> federal, or state securities laws. Unauthorized forwarding, printing, 
> copying, distribution, or use of such information is strictly 
> prohibited and may be unlawful. If you are not the addressee, please 
> promptly delete this message and notify the sender of the delivery 
> error by e-mail or you may call Cerner's corporate offices in Kansas City, 
> Missouri, U.S.A at (+1) (816)221-1024.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to