Click here to Skip to main content
16,020,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to read a .json file in google api,,,
iam not able to read a file,, please guide me fast...
the below is the code
JavaScript
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
  <script type="text/javascript">
      google.load('visualization', '1', { packages: ['table'] });
  </script>
  <script type="text/javascript">
      function drawVisualization() {
          // Create and populate the data table.
          var JSONObject = JSONObject.setJSONUrl("data.json"); ;
         var data = new google.visualization.DataTable(JSONObject, 0.5);
          // Create and draw the visualization.
          visualization = new google.visualization.Table(document.getElementById('table'));
          visualization.draw(data, { 'allowHtml': true });
      }
      google.setOnLoadCallback(drawVisualization);
  </script>

and the json data in file is :
XML

{cols: [{ id: 'task', label: 'Task', type: 'string' },{ id: 'hours', label: 'Hours per Day', type: 'number'}],rows: [{ c: [{ v: 'Work', p: { 'style': 'border: 7px solid orange;'} }, { v: 11}] },{c: [{ v: 'Eat' }, { v: 2}] },{ c: [{ v: 'Commute' }, { v: 2, f: '2.000'}]}] }
Posted
Updated 30-Jul-13 2:14am
v3
Comments
ZurdoDev 30-Jul-13 16:59pm    
So, where exactly are you stuck?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900