For json responses, i think it's good that the json is strict (i.e. no objects or callbacks allowed as values)
For constructing js objects to be included in the html (to configure other js components) it's clear that JSONObject isn't the correct answer (json != js object) Probably the autocmplete mixin needs to use a 'new' JsObject class On Mon, Mar 9, 2009 at 4:10 PM, ningdh <ningd...@gmail.com> wrote: > Not aware of that, sorry. > > In my window component, I hack to replace double quote of all function to > empty. > JSONObject options= new JSONObject(); > options.put("showEffect", "TO_BE_REPLACE" + this.showEffect+"TO_BE_REPLACE"); > > getPageRenderSupport().addScript("%s = new Window(%s);", getUniqueId(), > filterJsFunction(options.toString())); > > private String filterJsFunction(String jsonString) { > // function begin > jsonString = jsonString.replaceAll("\"TO_BE_REPLACE", ""); > // function end > jsonString = jsonString.replaceAll("TO_BE_REPLACE\"", ""); > > return jsonString; > } > > Well, a bit stupid, but works. > > DH > ----- Original Message ----- > From: "Francois Armand" <farm...@linagora.com> > To: "Tapestry users" <users@tapestry.apache.org> > Sent: Monday, March 09, 2009 9:51 PM > Subject: Re: Tapestry JSONObject : no 'function' type, any workaround ? > > >> ningdh wrote: >>> toString method of JsonObject would double quote our value. >>> One way is to create some data type extends jsonobject to encapsule your >>> data and override the toString method. I haven't tried it yet. >>> >> >> But JSONObject and JSONArray are final, that's not possible - it was my >> first plan. How can I workaround that ? >> >> >> -- >> Francois Armand >> Etudes & Développements J2EE >> Groupe Linagora - http://www.linagora.com >> Tél.: +33 (0)1 58 18 68 28 >> ----------- >> http://fanf42.blogspot.com >> InterLDAP - http://interldap.org >> FederID - http://www.federid.org/ >> Open Source identities management and federation >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org