javascript deep json clone
<p>I am trying to build small functions to simulate Class related functionalities (ok, I know about frameworks).</p>

<p>In the following example, the code almost work, it fails on deep cloning, somehow the Test.options.* fails to clone/copy, in all created objects options.* is the same reference, any idea what I have been doing wrong?</p>

<pre><code>//* class lib *//
function clone(o) {
    var tmp = new o.constructor();
    tmp.__proto__ = o;
    return tmp;
};
var Class = function(o) {
    var tmp = new Function();
    tmp.prototype = clone(o);
    return tmp;
};
//*/

//* object schema *//
var Test = new Class({
    deep: "yes",
    options: {
        inside: true
    }
});
//*/

//* object Test 1 *//
var t1 = new Test();
console.log(t1.deep); // "yes"
t1.deep = "no";
console.log(t1.deep); // "no"
console.log(t1.options.inside); // true
t1.options.inside = false;
console.log(t1.options.inside); // false
//*/

//* object Test 2 *//
var t2 = new Test();
console.log(t2.deep); // "yes"
console.log(t2.options.inside); // should be true but I get false
</code></pre>
