I'm sorry if this has already been answered, but after searching a bit
I didn't come up with any answers.  Does anyone know of a way to
serialize objects to JSON on the client side?  Ideally, it would work
similarly to the json2.js lib from json.org that I was using prior to
moving to the GWT, but anything relatively straightforward that
performs well is fine with me.

I tried wrapping the json2.js lib in a native method that calls
$wnd.JSON.stringify():

public abstract class JSONSerializer
{
    public static final native String serialize(final Object object)/*-
{
        return $wnd.JSON.stringify(object);
    }-*/;
}

but it pins my CPU and runs for several minutes when serializing
anything but a trivial object.  The problem seemed to be the verbosity
(completeness?) of the object when marshalled across the Java-
toJavascript boundary by the GWT.  I'd also like to control the
mapping of Java properties to JSON ones.

Surely there's a better way?  Or will I have to roll my own?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to