var DTO = [];
$.each(data.Foobars, function(i, val){
DTO.push(val);
});
//example of a stringified object in the array:
// var val = {"a":"1","b":"2","c":"3"};
var jsonString = JSON.stringify(DTO);
With one object in the array the ´jsonString´ would look like:
[{"a":"1","b":"2","c":"3"}]
With more than one:
[[{"a":"1","b":"2","c":"3"}, {"a":"1","b":"2","c":"3"}]]
Resulting in double brackets, which is causing me some problems serverside.
How can i get rid of the double brackets? Thanks
JavaScriptSerializershould have no problems with that :)console.log(DTO)?JSON.stringify(); but have you inspected the value ofDTOon the console?