There is nothing special about the name of the variable. The issue is what's in the variable. JSON format is actually a string that contains a structure. It looks like you have a string as shown in your message output, so then you will have to convert the string to a JavaScript object by parsing it.
Here is documentation on the JavaScript JSON.parse() function: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse We should try to make this all this clearer in the Google Charts documentation. On Sat, Jan 28, 2017 at 3:17 PM, franck danard <[email protected]> wrote: > Hi Daniel. > > It doesn't work but almost. > It's better, but something is weird. > > Now json request is formated correctly. > > {"cols":[{"label":"Room","type":"string"},{"label":" > Name","type":"string"},{"label":"Start","type":"date"}, > {"label":"End","type":"date"}],"rows":[{"c":[{"v":"Room > 200"},{"v":"Danard Franck *"},{"v":"Date(2017,0,28)"},{" > v":"Date(2017,0,31)"}]},{"c":[{"v":"Room 201"},{"v":"Danard Franck > *"},{"v":"Date(2017,0,29)"},{"v":"Date(2017,0,31)"}]}]} > > > > success: function (json) { > console.debug(json); > > var container = document.getElementById('timeline'); > var chart = new google.visualization.Timeline(container); > var dataTable = new google.visualization.DataTable(json); > > chart.draw(dataTable); > } > > > > This way returns an error. But!!!! > This way below works!!!! > If i make a copy and past the content of JSON request, it works. > > success: function (json) { > console.debug(json); > > var container = document.getElementById('timeline'); > var chart = new google.visualization.Timeline(container); > var dataTable = new google.visualization.DataTable( > {"cols":[{"label":"Room","type":"string"},{"label":"Name","type":"string"} > ,{"label":"Start","type":"date"},{"label":"End","type":" > date"}],"rows":[{"c":[{"v":"Room 200"},{"v":"Danard Franck > *"},{"v":"Date(2017,0,28)"},{"v":"Date(2017,0,31)"}]},{"c":[{"v":"Room > 201"},{"v":"Danard Franck *"},{"v":"Date(2017,0,29)"},{" > v":"Date(2017,0,31)"}]}]}); > > chart.draw(dataTable); > } > > > > I think there must be little to make it work. > > There's something to do arround the variable json ? > > Regards > > *Franck Danard* > Le 28/01/2017 à 19:11, 'Daniel LaLiberte' via Google Visualization API a > écrit : > > And here is an example using your json data as you copied, but with > "DATE"s changed to "Date"s: https://jsfiddle.net/dlaliberte/k97L511u/1/ > > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to google-visualization-api@ > googlegroups.com. > Visit this group at https://groups.google.com/ > group/google-visualization-api. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/google-visualization-api/02496535-f970-1189-01ad- > 03564b99d499%40gmail.com > <https://groups.google.com/d/msgid/google-visualization-api/02496535-f970-1189-01ad-03564b99d499%40gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> [email protected] <[email protected]> 5CC, Cambridge MA -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJPLqY2DNFzncw3PgU1nn8vashAQsf5BhXOx%2BtqFT2Wzew%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
