In my GWT project I need to process json data retrieved from a database via PHP. I have seen the Google examples using JavaScriptObject overlay classes. What I don’t understand is why this seems to be the prefered method of processing the json data. Why shouldn’t I use all native Java code to pull in the data?
Share
Think about it the other way around: what does it mean to use POJOs? (or native Java classes as you name them)
You have to:
com.google.gwt.json.client.JSONObject, orelemental.json.JsonObject)On the other hand, with
JavaScriptObject, you useJsonUtil.safeEvaland TA-DA! you get your JSON parsed right into a typed Java object!Now, to deal with JSON, there’s also AutoBeans.
Choose your poison.