Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Jun 09, 2008 11:49
open dhtmlx forum
Problem loading dhtmlxGrid with JSON data

I am trying to load dhtmlxGrid with JSON data, and get an error in the _process_json function in dhtmlxgrid.js - on the "eval(data=...") line.

The data, in examining data.xmlDoc.responseText prior to the eval line, is as follows:
{"rows":[
{"id":"1",
"data":[
    "name": "Stainless",
    "type": "texture",
    "description": "some description here",
    "imageName": "BrushedSS.bmp"
    ]
}
]
}

The eval line is returning the following error: Expected ']'

I am using the following code to retrieve my data from the server side, using Java:
gg.load("getData.htm?mode=loadData", "json"); (where gg is my dhtmlXGridObject)

Would you please provide some assistance/direction with the format of my JSON data?

Thanks!

Answer posted by Support on Jun 10, 2008 03:03
Default json routine takes just the array of data, not named list. So the correct syntax is

{"rows":[
{"id":"1",
"data":[
    "Stainless",
    "texture",
    "some description here",
    "BrushedSS.bmp"
    ]
}
]
}