I have an array generated with the following code where $result is a collection with Salesman a string field and col1 an integer field
$data=[];
$arr = ($result->get());
$j=0;
foreach($arr as $res)
{
$data[$j] = [$res->shortName,$res->col1];
$j++;
}
And when i pass this array to Google Charts using json_encode like
var data = google.visualization.arrayToDataTable({!! json_encode($data) !!}
it is rendered in Javascript as:
var data = google.visualization.arrayToDataTable([["John","700000"],["Jessa","1400000"],["Mercy ","1100000"],["William","780000"],["Thomas","550000"]]
);
As you can see the integer numbers are also rendered as strings with a quote. Is there any way to avoid this ?