The function angular.fromJson
will deserialize a valid JSON string and return an Object or an Array.
angular.fromJson(string|object)
Note that this function is not limited to only strings, it will output a representation of any object passed to it.
Examples:
angular.fromJson("{\"yogurt\": \"strawberries\"}")
// Object {yogurt: "strawberries"}
angular.fromJson('{jam: "raspberries"}')
// will throw an exception as the string is not a valid JSON
angular.fromJson(this)
// Window {external: Object, chrome: Object, _gaq: Y, angular: Object, ng339: 3…}
angular.fromJson([1, 2])
// [1, 2]
typeof angular.fromJson(new Date())
// "object"