I must convert a string representation of an array of objects returned from AJAX to an array of objects in JavaScript.
ajaxret = "[{a:'a', b:'b', c: 1},{a:'aa', b:'ab', c: 2},{a:'aaa', b:'bbb', c: 3}]"
strResult = [{a:'a', b:'b', c: 1},{a:'aa', b:'ab', c: 2},{a:'aaa', b:'bbb', c: 3}]
JSON.parse(). How are you creatingajaxret? Why is it returning an invalid JSON string? If you can fixajaxret, thenJSON.parse()will work great :)