> On the other hand, I tried printing out the return value of
> $wnd.__getMapJs() and that turns to be a huge JavaScript Object and I
> have no idea how to iterate through it. So an example will help
> tremendously.






{"data":[{"post":0,"fax":"","idCustomerType":1,"idLanguage":0,"tel":"","street":"","inboxSize":4194304
,"idCountry":0,"idAgency":1,"contact":"","isActive":1,"id":286,"email":"","name":"UVI","connectionSpeed"
:131072,"contactMobile":"","activeFilters":1}],"total":1}


I'd use the getters and setters if you have them in a bean someplace.

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONValue;

For example (see the api to handle an array):



JSONObject dataHolder;

public String handleData(JavaScriptObject jsData) {
Customer = new Customer();//sample bean with typical getters and setters
        dataHolder = new JSONObject(jsData);
       
setPost((int)dataHolder.get("data").isObject().get("post").isNumber().doubleValue());
setEmail(dataHolder.get("data").isObject().get("email").isString().toString());

etc etc.


}

If you are getting back json as a String and not JavaScriptObject,
then you'll have to parse it into a JavaScriptObject first.

--~--~---------~--~----~------------~-------~--~----~
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