is there to make ko.ToJson ignore certain fields?

https://groups.google.com/d/topic/knockoutjs/wn52WeqvR1Q/discussion

by swarups

HTML

<script src="https://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.js"></script>
<script src="http://knockoutjs.com/downloads/knockout-2.2.1.js"></script>
<div data-bind="text: ko.toJSON(viewModel)"></div>

JavaScript

function Child(name, parent) {
    this.name = ko.observable(name);
    this.parent = parent;
    this.children = [];
    this.children.push(new GrandChild("value1", "type1"));
    this.children.push(new GrandChild("value2", "type2"));
}

function GrandChild(value, type) {
	this.value= ko.observable(value);
  this.type = ko.observable(type);
}

GrandChild.prototype.toJSON = function() {
    var copy = ko.toJS(this);
    delete copy.value;
    return copy;
}

Child.prototype.toJSON = function() {
    var copy = ko.toJS(this);
    delete copy.parent;
    return copy;
}

var viewModel = {
    title: ko.observable("section title"),
    children: ko.observableArray()
};

viewModel.children.push(new Child("one", viewModel.children));
viewModel.children.push(new Child("two", viewModel.children));


ko.applyBindings(viewModel);