Node.js examples for String:String Value
Add method to Object to return json String and deal with null value
Object.prototype.toJSON = function(){ var json = [];/*from www. ja v a 2 s . c o m*/ for(var i in this){ if(!this.hasOwnProperty(i)) continue; //if(typeof this[i] == "function") continue; json.push( i.toJSON() + " : " + ((this[i] != null) ? this[i].toJSON() : "null") ) } return "{\n " + json.join(",\n ") + "\n}"; }