fixes #1: adding toJSON method so json will stringify correctly
Merge pull request #2 from scurker/bug/json-stringify

fixes #1: adding toJSON method so json will stringify correctly