I am working through the mapping plugin example on the Knockoutjs website.
This is the example data.
Knockout JS Mapping Plugin
var data = {
Note that to define additional computed observables on a child you will need to pass another set of mapping options
var mapping = {
create: function(options) {
//customize at the root level.
var mapping2 = {
'children': {
create: function(options) {
//customize children also
}
}
}
//call ko.mapping.fromJS on the options.data as well with further customization
ko.mapping.fromJS(options.data, mapping2, this);
}
};