Implementing toJSON function on Item

Invoking JSON.stringify on an Item instance can cause execution to hang, probably due to circular references within the Table object that is part of the internal Item state. It seems reasonable to assume that serializing only the attributes is desired when invoking JSON.stringify on a vogels Item instance. One example of this is a REST service implemented with Express where the Response.json function internally invokes JSON.stringify. 

According to Crockford's json2 standard, a toJSON function can be implemented on an object which returns the actual object that should be serialized. In this case simply returning "this.attrs" does the trick.

http://stackoverflow.com/questions/4289282/how-do-you-use-json-stringify-in-a-custom-tojson-method