Sorry, Rpn, I just realised I never actually answered your query about compareArrays!
ko.utils.compareArrays compares elements using the strict comparison (===) operator, so as you point out, if you have two different objects deserialized from JSON they will be treated as different (because they are different objects in memory), even if logically they represent the same entity as far as you are concerned.
It would certainly be possible to add a futher "comparer" callback function by which you could supply custom comparison logic and then just compare something like a primary key property. But would this actually be useful to you? If you had changed some other property (not the primary key), then you'd still see the two objects as being equal even though one has been edited. It sounds like you're really trying to difference two entire object graphs, including all the properties, which is vastly more complex and your existing solution of comparing their JSON representations is really the only practical approach I can think of.
Please let me know if you can think of a particular use case for adding a "comparer" callback to ko.utils.compareArrays.
kgvi...@gmail.com: It really does work in exactly the same way as a regular observable. For example,
var viewModel = { myObsArray : ko.observableArray([]) };
viewModel.myObsArray.subscribe(function(value) { alert("Got updated array: " + JSON.stringify(value)) });
viewModel.myObsArray.push("ABC");
viewModel.myObsArray.push("DEF");
Regards
Steve