I'm working on some website, and am using JSON. My problem is the JSON.parse method, I use it to send a simple array, and append to an array the values. And I always get an extra element at the end that us just commas. here is the simplified code:
responseText = '["dummy1", "dummy2", "dummy3", "dummy4"]';
var clientList=[];
try {
JSON.parse(responseText, function(key, val){clientList.push(val)});
} catch (e) {
alert('no');
}
alert(clientList.length);
First in IE its not working at all (exception is thrown).
Second chrome the result is that clientList is an array of 5 strings, while the last one is ',,, '.
Why is that extra value there? Can I get rid of it (without just popping the array at the end)? And what is wrong with IE?