When using Angular's fromJson function to parse a JSON string, I encountered an issue. If the JSON is a simple array like "[1, 2]", the code works fine. However, I need to work with an array of dictionaries instead.
var str = "[{'title':'hi'}, {'title':'what'}]"
alert(str) //1
alert(str.length) //2
var j = angular.fromJson(str)
alert(j) //3
alert(j.length) //4
Alerts for 1 and 2 show the string representation, but alerts for 3 and 4 indicate that fromJson has encountered an error.
Note: This issue is unrelated to JSON.parse or $._parseJSON functions; I must use the Angular method for specific reasons.