JSON representation/parsing of dates

45 views
Skip to first unread message

140Kit Team

unread,
Jul 28, 2011, 3:12:07 PM7/28/11
to Google Visualization API
Hey all,

Thanks to your tips, I was able to overcome the hurdle of sorting and
organizing the DataTable. I have one last question, and that concerns
the correct way to deal with dates. As I see, you can specify a date
or datetime as a column type. What form does the date need to take in
order to get correctly parsed as a date, when its coming from JSON? Do
you have to do something gross like iterating through and re-setting
all the values as datetime objects, or is there some format you can
pust the json out as so that it comes in as a date?

asgallant

unread,
Jul 28, 2011, 3:34:42 PM7/28/11
to google-visua...@googlegroups.com
According to the documentation, the API uses a modified version of JSON that allows passing dates.  See http://code.google.com/apis/chart/interactive/docs/dev/implementing_data_source.html#json_modifications

I vaguely recall some people having trouble with that a while back, though, so it might not be working correctly.

Viz Kid

unread,
Aug 1, 2011, 3:43:20 AM8/1/11
to google-visua...@googlegroups.com

Are you implementing your own data source? The data source library should handle date and datetime for you and create the proper JSON that you can use in the javascript. You should not go over the JSON and change the types. (When this is done via jsonp, objects are returned there.)

Hope this helps,
  Viz Kid

On Thu, Jul 28, 2011 at 10:34 PM, asgallant <drew_g...@abtassoc.com> wrote:
According to the documentation, the API uses a modified version of JSON that allows passing dates.  See http://code.google.com/apis/chart/interactive/docs/dev/implementing_data_source.html#json_modifications

I vaguely recall some people having trouble with that a while back, though, so it might not be working correctly.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/4wFFU8xseCwJ.

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.

Reply all
Reply to author
Forward
0 new messages