aboutsummaryrefslogtreecommitdiffstats
path: root/src/JSON.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/JSON.js')
-rw-r--r--src/JSON.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/JSON.js b/src/JSON.js
index 7fdbf1a1..d0ded009 100644
--- a/src/JSON.js
+++ b/src/JSON.js
@@ -40,15 +40,17 @@ function fromJson(json, useNative) {
try {
if (useNative && window.JSON && window.JSON.parse) {
obj = JSON.parse(json);
- return transformDates(obj);
+ } else {
+ obj = parser(json, true).primary()();
}
- return parser(json, true).primary()();
+ return transformDates(obj);
} catch (e) {
error("fromJson error: ", json, e);
throw e;
}
// TODO make forEach optionally recursive and remove this function
+ // TODO(misko): remove this once the $http service is checked in.
function transformDates(obj) {
if (isString(obj) && obj.length === DATE_ISOSTRING_LN) {
return angularString.toDate(obj);