Enable toJSON function to return different types
0.1.3
Added options.replacer for custom object serialization