This repository has been archived by the owner on Jul 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
feature request: toJSON() #19
Comments
function A() {
this.t = 4;
this.prop = "test";
}
A.prototype.toJSON = function() {
return {prop: this.prop}
}
var a = new A; If tl;dr You might want to change this request to use a different function name. |
Can you help clarify? If I have an array: var myArray = [ "one", "two" ]; and I pack that with msgpack.pack: var binaryData = msgpack.pack(myArray); You want a function that let's you say: var jsonString = msgpack.unpack(binaryData, 'JSON'); I tend to agree with download13, we should not call it msgpack.toJSON(). I think making something like this an option to unpack is more desirable. Is this what you mean? |
mikepb
added a commit
to mikepb/node-msgpack
that referenced
this issue
Aug 19, 2013
mikepb
added a commit
to mikepb/node-msgpack
that referenced
this issue
Aug 19, 2013
closing because of #50 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It would be really nice if msgpack could directly turn its binary representation into a JSON string, avoiding parse from msgpack -> stringify to JSON. Besides the potential performance benefit, not having this step would avoid a lot of object creation, which could really help the garbage collector to take it easy.
The text was updated successfully, but these errors were encountered: