Martin, Im not sure I catch what your saying. I understood it was the json plugin that determined the format of the json response. I am not using an autocompleter either.
-Ryan -----Original Message----- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Thursday, March 13, 2008 4:15 PM To: Stanley, Eric Cc: Struts Users Mailing List Subject: Re: JSON plugin Eric- it appears that its up to your action to return proper JSON formatted results here is the doc Autocompleter input format The text to be returned from your action must be a list in JSON (Javascript Object Notation). Make sure your action returning the JSON list is not decorated adding any extra content. Like: [ ["Display Text1", "Value1"], ["Display Text2", "Value2"] ] you *can* also configure in a valid JSON validator such as so these errors do not happen in View layer.. <interceptor-stack name="defaultStack"> <interceptor-ref name="validationWorkflowStack"/> </interceptor-stack> <interceptor-stack name="validationWorkflowStack"> <interceptor-ref name="basicStack"/> <interceptor-ref name="validation"/> <interceptor-ref name="workflow"/> </interceptor-stack>Martin- ----- Original Message ----- From: "Stanley, Eric" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <user@struts.apache.org> Sent: Thursday, March 13, 2008 3:57 PM Subject: RE: JSON plugin Musachy, I tried just printing out responseObject[i] where I was 1-10, and it returns the actual characters of the response like it is an array: responseObject[0] = [ responseObject[1] = { responseObject[2] = " Is it a problem with converting my ArrayList<Project> into json? -Ryan -----Original Message----- From: Musachy Barroso [mailto:[EMAIL PROTECTED] Sent: Thursday, March 13, 2008 2:36 PM To: Struts Users Mailing List Subject: Re: JSON plugin you don't have a "projectList" field in the response, only an array of objects. If you do: responseObject[0].name it will return "Alarming page". musachy On Thu, Mar 13, 2008 at 4:30 PM, Stanley, Eric <[EMAIL PROTECTED]> wrote: > I am trying to use dojo and the JSON plugin, but I have hit a snag. I > am using JSON to serialize: ArrayList<Project> projectList. > > It seems to do this fine, as I can see the result in firebug. The > problem I am having is that the JSON response seems to be missing > something, and I cant figure out how to remedy this. > > This is the dojo example json: > { "cobblers": [ > {"filling": "peach", "timeToBake": 30 }, > {"filling": "cherry", "timeToBake": 35 }, > {"filling": "blueberry", "timeToBake": 30} > ] > } > > This is how they parse it (abbreviated): > console.dir(responseObject.cobblers[0].filling); // Prints "peach" > > In my code I run "console.dir(responseObject);" and get this > displayed in firebug: > [ > { > "acdate":null, > "approved":false, > "id":236, > "lead":{"cuid":"hsimpso","id":2,"name":null,"role":2}, > "loe":{"id":2,"name":"Medium"}, > "mos":"Create something.", > "name":"Alarming page", > "owner":{"cuid":"mburns","id":14,"name":null,"role":0}, > "priority":{"id":1,"name":"High"}, > "result":"Waiting on something", > "status":{"hlaOnly":null,"id":6,"name":"OnHold"}, > "stdate":"2006-03-14T00:00:00", > "tcdate":"2006-05-12T00:00:00" > }, > > { > "acdate":"2008-02-01T00:00:00", > "approved":false, > "id":1749, > "lead":{"cuid":"mxsimps","id":2,"name":null,"role":2}, > "loe":{"id":4,"name":"Extra Large"}, > "mos":"Rewrite stuff.", > "name":"Rewrite that", > "owner":{"cuid":"mburns","id":14,"name":null,"role":0}, > "priority":{"id":1,"name":"High"}, > "result":"I done did it....", > "status":{"hlaOnly":null,"id":4,"name":"Completed"}, > "stdate":"2007-07-16T00:00:00", > "tcdate":"2008-02-01T00:00:00" > } > ] > > That seems okay to me. I hit the snag when I try something like this: > console.debug(responseObject.projectList[0].name); > > This is whats returned: > responseObject.projectList has no properties > > Im not sure how to address the response. Any ideas? > > -Ryan > > > This communication is the property of Qwest and may contain > confidential or privileged information. Unauthorized use of this > communication is strictly prohibited and may be unlawful. If you > have received this communication in error, please immediately notify > the sender by reply e-mail and destroy all copies of the communication and any attachments. > -- "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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]