I have the following observable array:
self.users = ko.observableArray();
which has elements of the following object:
function user(id, name, score) { this.id = id; this.name = name; this.score = ko.observable(score); }
I need to save this observable array locally on the user machine (simplified example), so for this I use the localstorage and ko.toJSON . This works fine, and all data is stored in localstorage, including the score element, which is observable. The problem is that I cannot convert this string back to an observable array. When I do JSON.parse and pass it to a self.users score , it is no longer observed. Is there any function like ko.parse to ko.toJSON back ko.toJSON ?
source share