JSON GWT question

7 views
Skip to first unread message

naseeratgwt

unread,
Oct 5, 2007, 10:23:55 AM10/5/07
to Google Web Toolkit
Hi,

I am new to GWT. Here is what I want to do.

I have my Domain Objects which have to be passed to GWT Server layer
to get rendered in UI.

Instead of passing the Domain Objects as Java objects I have decided
to convert the Domain Objects to JSON objects and pass it to the GWT
Server Layer.

My questions are as follows:

(1) Is there any out of box Pojo to JSON converter that I can use,
preferably provided by GWT.
(2) I am not interested in using JSON_RPC I just need JSON to as as
data transfer object between my Domain layer and GWT Server layer. Can
I do this.
(3) Are there any examples that provide my a sample to the above
approach. The example provided in GWT dist package is using JSON to
communicating to other server I guess. I need a simple example which
will use JSON instead of a Java Object to display the content on the
browser.

Also provide comments on the approach I am taking.

TIA,
Naseer.

Peter Blazejewicz

unread,
Oct 5, 2007, 4:08:32 PM10/5/07
to Google Web Toolkit
hi Nasser,

#1
http://xstream.codehaus.org/
it is used e.g. in Grails framework to provide JSON converter

#2
there is no JSON_RPC in default tookit api, Simply use plain HTTP
rquest (e.g. restfull) and convert results to JSON object


#3
rocket-gwt library has json serializer:
http://code.google.com/p/rocket-gwt/wiki/JsonSerialization

#4
you can use JavaScript interop project to bind JSON object to Beans on
client side:
http://code.google.com/p/gwt-api-interop/

regards,
Peter

naseeratgwt

unread,
Oct 5, 2007, 11:23:30 PM10/5/07
to Google Web Toolkit
Thanks for all the above information.

On Oct 5, 4:08 pm, Peter Blazejewicz <peter.blazejew...@gmail.com>
wrote:
> hi Nasser,
>
> #1http://xstream.codehaus.org/

mP

unread,
Oct 6, 2007, 9:29:24 PM10/6/07
to Google Web Toolkit
Andres also written a package called jsonizer - which also solves your
problem. I naturally would encourage you to use my one (rocket-gwt) :).

Reply all
Reply to author
Forward
0 new messages