Open endel opened 6 years ago
I'm wondering if it's feasible to implement toJSON support on msgpack-lite?
toJSON
JSON.stringify() supports handling custom toJSON methods, like:
JSON.stringify()
function MyData () {} MyData.prototype.toJSON = function() { return { custom: new Custom(), output: 2 }; } function Custom() {} Custom.prototype.toJSON = function() { return "recursive"; } JSON.stringify(new MyData()) // => "{"custom":"recursive","output":2}"
Would be great to have the ability to customize the serialization for msgpack too.
Cheers!
Some of Objects already support toJSON() serializing method. It sounds a good idea to divert it for us instead of building our own toMsgpack() method. Thanks.
toJSON()
toMsgpack()
I'm wondering if it's feasible to implement
toJSON
support on msgpack-lite?JSON.stringify()
supports handling customtoJSON
methods, like:Would be great to have the ability to customize the serialization for msgpack too.
Cheers!