jonmadison I'm not 100% sure but I believe this is all included in the new JS API, I would recommend checking that out first.
I ended up using MSJSONDataArchiver being sure the set archiveObjectIDs
to true. A full example looks like:
var archiver = MSJSONDataArchiver.new();
archiver.archiveObjectIDs = true;
// This could be whatever you need
var rawData = {
"symbol": symbolObject
}
// Archive the data and check for an error
var aPtr = MOPointer.alloc().init();
archiver.archivedDataWithRootObject_error(rawData, aPtr)
if (aPtr.value()) {
return; // Error
}
// Get the NSData
var archive = archiver.archivedData();
As for restoring from the archive, I ended up getting it to work as follows. Note that it seems you have to know what version the data was originally archived with.
var myData = // load the archive as a string
var fromVersion = // the version myData was archived with
MSJSONDataUnarchiver.unarchiveObjectWithString_asVersion_corruptionDetected_error(myData, fromVersion, nil, nil)