diff --git a/lib/schemaobject.js b/lib/schemaobject.js
index <HASH>..<HASH> 100644
--- a/lib/schemaobject.js
+++ b/lib/schemaobject.js
@@ -428,6 +428,10 @@ var SchemaObject = function(schema) {
       return getObj;

     };

 

+    // toJSON is an interface used by JSON.stringify.

+    // Return the raw object if called.

+    this.toJSON = this.toObject;

+

     // Clear all values.

     this.clear = function() {

       self._obj = {};

diff --git a/test/tests.js b/test/tests.js
index <HASH>..<HASH> 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -752,6 +752,18 @@ describe('toObject()', function() {
     var obj = o.toObject();

     should.not.exist(obj.invisible);

   });

+

+  it('should be called for serializing an object to JSON', function() {

+    var o = new SO();

+    o.string = 'hello';

+    o.date = new Date();

+    o.schemaObject.string = 'test';

+    o.schemaObjects.push({string: 1234});

+

+    var obj = JSON.stringify(o.toObject());

+    var jsonObject = JSON.stringify(o);

+    obj.should.equal(jsonObject);

+  });

 });

 

 describe('type definition', function() {
Added support for toJSON interface.