problem parsing JSON Strings
- by blacktooth
var records = JSON.parse(JsonString);
for(var x=0;x<records.result.length;x++)
{
var record = records.result[x];
ht_text+="<b><p>"+(x+1)+" "
+record.EMPID+" "
+record.LOCNAME+" "
+record.DEPTNAME+" "
+record.CUSTNAME
+"<br/><br/><div class='slide'>"
+record.REPORT
+"</div></p></b><br/>";
}
The above code works fine when the JsonString contains an array of entities but fails for single entity. result is not identified as an array!
Whats wrong with it?
http://pastebin.com/hgyWw5hd