UndefinedObject>>#asJSON

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

UndefinedObject>>#asJSON

Amber Milan Eskridge
Hello

I push some data through socket.io to some clients. Sometimes some datum is nil; on the receiving side, this will then be reconstructed to {} becomin' [Object object] which is #notNil, I believe. If this is the case, could it be a good idea to redefine asJSON in UndefinedObject to be something like 

UndefinedObject>>#asJSON
        < return null; >

or maybe

UndefinedObject>>#asJSON
        < return JSON.stringify(null); >

?

Any help would be appreciated. 

I miss Cocoa's -encodeWithCoder: :)