I don't get that error when I use your JSON:
http://jsfiddle.net/asgallant/R8tA9/. Can you post an example script
(preferably on jsfiddle, you can use the example I linked to as a starting
point) that replicates the issue?
On Monday, August 12, 2013 3:19:07 PM UTC-4, Razee Hussein-Jamal wrote:
>
>
> I am trying to view my JSON string I receive from a database and view it
> in google tables, however I receive this error: Invalid JSON string:
> error: 1046
>
> In viewTable.php a part of the script is :
>
> function drawVisualization() {
>
> var jsonData = $.ajax({
> url: "json.php", // make this url point to the data file
> dataType: "json",
> async: false
> }).responseText;
> var data = new google.visualization.DataTable(jsonData);
>
> visualization = new
> google.visualization.Table(document.getElementById('table'));
> visualization.draw(data, null);
>
> }
>
> in json.php file : I query data from database and encode it to JSON string
> which I then echo $jsonString,
>
> An example of JSON string output :
>
>
> {"cols":
> [{"id":"A","label":"Date","type":"string"},{"id":"B","label":"User","type":"string"},{"id":"C","label":"Cement
>
> Brand","type":"string"},{"id":"D","label":"Volume","type":"string"},{"id":"E","label":"Type","type":"string"}],
>
> "rows":
> [{"c":[{"v":"08-06-2013"},{"v":"[email protected]
> <javascript:>"},{"v":"Muthana"},{"v":"27"},{"v":"Local
> Plant"}]}]
> }
>
>
> I would really appreciate any help with this problem as I can't find the
> reason for this invalid JSON string as it seems to be correct. Thank you
>
>
>
>
>
>
>
--
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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.