Convert Java bean Object to JSON in GWT 2.4

1,393 views
Skip to first unread message

GereMora

unread,
Oct 12, 2011, 3:53:11 PM10/12/11
to Google Web Toolkit
Hi Guys!,

I'm working in a Project with GWT 2.4 + Smart GWT 2.5. I need convert
my Java beans in JSON string.
I tried with some library without success (gwtprojsonserializer,
gwtjsonizer and the AutoBean framework of GWT).

Anyone know of a library that works for this?.. Let me know!.

Thanks!.

Gere.

Tomasz Gawel

unread,
Oct 12, 2011, 6:38:02 PM10/12/11
to Google Web Toolkit
As to JSON:
Have you tried Google GSON library ? http://code.google.com/p/google-gson/

And second question:
Do you really need JSON?
RequestFactory does not suit your case?
http://code.google.com/intl/pl/webtoolkit/doc/latest/DevGuideRequestFactory.html

Gal Dolber

unread,
Oct 12, 2011, 6:41:30 PM10/12/11
to google-we...@googlegroups.com
here's another nice project http://code.google.com/p/piriti/ to use on the client side


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




--
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/




GereMora

unread,
Oct 13, 2011, 11:40:05 AM10/13/11
to Google Web Toolkit
I don't know Request Factory!.. Sounds good.

In my case, I need work with Java beans with Smart GWT Dataousources.
I'll investigate Request Factory.

Thks!

Gere.

On Oct 12, 7:38 pm, Tomasz Gawel <tomaszga...@op.pl> wrote:
> As to JSON:
> Have you tried Google GSON library ?http://code.google.com/p/google-gson/
>
> And second question:
> Do you really need JSON?
> RequestFactory does not suit your case?http://code.google.com/intl/pl/webtoolkit/doc/latest/DevGuideRequestF...

Sanjiv Jivan

unread,
Oct 13, 2011, 12:09:09 PM10/13/11
to google-we...@googlegroups.com
Gere,
Can you elaborate what you're trying to do here? What kind of datasource are you using in SmartGWT and where are you trying to convert the beans to JSON? If you're using RestDataSource then you're probably converting your beans to JSON on the server side and for this you can use a library like XStream or FlexJSON ( http://flexjson.sourceforge.net/ ).  As Gal Dolber mentions, piriti can be used to convert beans to JSON on the client side but this might not be what you're looking for.

Use of RequestFactory is not required or appropriate when working with Smart GWT datasources.

Sanjiv



GereMora

unread,
Oct 18, 2011, 11:28:54 AM10/18/11
to Google Web Toolkit
Hey guys, I'm using piriti (http://code.google.com/p/piriti/) for
convert POJO to JSON and reverse. Works fine.

Thanks for your help.

Gere.

On Oct 13, 1:09 pm, Sanjiv Jivan <sanjiv.ji...@gmail.com> wrote:
> Gere,
> Can you elaborate what you're trying to do here? What kind of datasource are
> you using in SmartGWT and where are you trying to convert the beans to JSON?
> If you're using RestDataSource then you're probably converting your beans to
> JSON on the server side and for this you can use a library like XStream or
> FlexJSON (http://flexjson.sourceforge.net/).  As Gal Dolber mentions,
Reply all
Reply to author
Forward
0 new messages