Read data from javascript objects

Hello,

i’m trying to insert data from javascript into my gantt chart.

The data is created like that:

initializeGantt : function(data)
					{
						var tasks = new Array();
						for (var i = 0; i < data.length; i++)
						{
							var obj = {
								id : i + 1,
								text : data[i].text,
								duration : data[i].duration,
								start_date : data[i].start_date
							};
							tasks.push(obj);
						}

						var o = {
								data : tasks
						};
						
						gantt.parse(o);
}

The resulting object looks like that converted to json:

{  
   "data":[  
      {  
         "id":1,
         "text":"Task 1",
         "duration":24,
         "start_date":"13-10-2014"
      },
      {  
         "id":2,
         "text":"Task 2",
         "duration":30,
         "start_date":"13-10-2014"
      },
      {  
         "id":3,
         "text":"Task 3",
         "duration":36,
         "start_date":"13-10-2014"
      },
      {  
         "id":4,
         "text":"Task 4",
         "duration":120,
         "start_date":"13-10-2014"
      },
      {  
         "id":5,
         "text":"Task 5",
         "duration":0,
         "start_date":"13-10-2014"
      },
      {  
         "id":6,
         "text":"Task 6",
         "duration":0,
         "start_date":"13-10-2014"
      },
      {  
         "id":7,
         "text":"Task 7",
         "duration":0,
         "start_date":"13-10-2014"
      },
      {  
         "id":8,
         "text":"Task 8",
         "duration":0,
         "start_date":"13-10-2014"
      }
   ]
}

What am I doing wrong here?

Thanks for any help

The Error i get is:
Uncaught TypeError: Cannot read property ‘length’ of null dhtmlxgantt.js:8911

Here:

	str_to_date:function(format,utc){
		var splt="var temp=date.match(/[a-zA-Z]+|[0-9]+/g);";
		var mask=format.match(/%[a-zA-Z]/g);
		for (var i=0; i<mask.length; i++){

str_to_date:function(format,utc){
var splt=“var temp=date.match(/[a-zA-Z]+|[0-9]+/g);”;
var mask=format.match(/%[a-zA-Z]/g);
for (var i=0; i<mask.length; i++){ <—

I found the problem… it was my fault, i was executing the code too early, before the chart was loaded.