Update to use JSON.{parse,stringify}

This commit is contained in:
Tom Robinson
2009-06-13 11:42:22 -07:00
committed by Francisco Ryan Tolmasky I
parent 774ea99319
commit 787e0c8afd
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -491,7 +491,7 @@ var CPColorPanelSwatchesCookie = "CPColorPanelSwatchesCookie";
var future = new Date();
future.setYear(2019);
[_swatchCookie setValue: CPJSObjectCreateJSON(result) expires:future domain: nil];
[_swatchCookie setValue: JSON.stringify(result) expires:future domain: nil];
}
- (void)setColorPanel:(CPColorPanel)panel
+2 -2
View File
@@ -83,7 +83,7 @@ var CPValueValueKey = @"CPValueValueKey";
self = [super init];
if (self)
_JSObject = CPJSObjectCreateWithJSON([aCoder decodeObjectForKey:CPValueValueKey]);
_JSObject = JSON.parse([aCoder decodeObjectForKey:CPValueValueKey]);
return self;
}
@@ -94,7 +94,7 @@ var CPValueValueKey = @"CPValueValueKey";
*/
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeObject:CPJSObjectCreateJSON(_JSObject) forKey:CPValueValueKey];
[aCoder encodeObject:JSON.stringify(_JSObject) forKey:CPValueValueKey];
}
@end
+1 -1
View File
@@ -28,7 +28,7 @@ function readConfig(configFile)
if (!fileData)
throw new Error("Couldn't read file: " + configFile);
var configs = CPJSObjectCreateWithJSON(fileData);
var configs = JSON.parse(fileData);
return configs;
}
+1 -1
View File
@@ -239,7 +239,7 @@ function main()
// add fake bundle response bookkeeping
applicationJS.push("var __fakeDidReceiveBundleResponse = " + String(fakeDidReceiveBundleResponse));
applicationJS.push("var __fakeBundleArchives = " + CPJSObjectCreateJSON(bundleArchives) + ";");
applicationJS.push("var __fakeBundleArchives = " + JSON.stringify(bundleArchives) + ";");
applicationJS.push("for (var i = 0; i < __fakeBundleArchives.length; i++) __fakeDidReceiveBundleResponse(__fakeBundleArchives[i]);")
// add each fragment, wrapped in a function, along with OBJJ_CURRENT_BUNDLE bookkeeping