How do I extract data from a JSON object and how is the JSON object is defined?

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by hardeep on 23rd September 2015
how to extract data from json object and how the json object is defined on the other page.

like this example

i want to extract the values from the json object and my json object is


and how to extract data from this json object
Posted by hardeep on 23rd September 2015
i got error:-

RGraph.line.js:50 Uncaught TypeError: Cannot read property 'getContext' of null

in my console
Posted by Richard Heyes on 23rd September 2015
Hi there,

You need to convert the data in your object to real numeric values instead of strings as it is now. You can do that like this:

var obj =
for (var i=0; i<obj.value.length; i+=1) {
     var arr = obj.value[i].split(/,/);

     // Convert strings to numbers
     for (var j=0; j<arr.length; j+=1) {
         arr[j] = parseInt(arr[j]);

     obj.value[i] = arr;

var data = obj.value;

// This is an RGraph function that logs variables to the
// browser console

And if you are getting a getContext error - you're probably using the wrong ID (of the canvas) in your constructor.


Add a reply

« Back to message list