Java: Json to DataTable object

520 views
Skip to first unread message

Edwin van de Koppel

unread,
Mar 10, 2011, 5:58:16 AM3/10/11
to Google Visualization API
Hello all,

I am using the google-visualization-java in my Java AppEngine/GWT
project (Eclipse).

From the client side I am doing a HTTP get to the server side to
retrieve a com.google.visualization.datasource.DataTable object.
On that server side the DataTable object is being built up from the
app engine datastore OR memcache. In order to be able to store a
DataTable into memcache, it has to be serializable. Therefore, I
convert it to a JSON string:

String aJsonString = JsonRenderer.renderDataTable(myDataTable, true,
true).toString();

(JsonRenderer is part of the google-visualization-java package)
Yet, I cannot figure out how to turn a JSON string back into a
DataTable object.

I have tried the following:

public static native DataTable toDataTable(String theJsonString) /*-{
return new DataTable(eval("("+theJsonString+")"));
}-*/;
DataTable myDataTable = toDataTable(aJsonString);

but then I am getting a java.lang.UnsatisfiedLinkError.

So what am I doing wrong? Or is there another way?

MC Get Vizzy

unread,
Mar 10, 2011, 9:47:12 AM3/10/11
to google-visua...@googlegroups.com
I'm not sure I understand.  You need to deserialize the DataTable on the client or the server?


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


Edwin van de Koppel

unread,
Mar 10, 2011, 10:31:25 AM3/10/11
to Google Visualization API
Still on the server side.

MC Get Vizzy

unread,
Mar 13, 2011, 8:55:09 AM3/13/11
to google-visua...@googlegroups.com, Edwin van de Koppel
Sorry, we don't currently have any support for that.  (By the way, I think your code is failing because you can't use GWT native code on the server side.)

Edwin van de Koppel

unread,
Mar 15, 2011, 5:26:59 AM3/15/11
to Google Visualization API
Ok, so as I understand there is a way to turn a DataTable into a JSON
string, but not visa versa?
Will the JSON -> DataTable functionality become available anytime
soon?
Reply all
Reply to author
Forward
0 new messages