Node.js examples for String:Convert
Convert String to Json string
String.prototype.toJSON = function(){ return '"' + this.replace(/(\\|\")/g,"\\$1") .replace(/\n|\r|\t/g,function(){ var a = arguments[0]; return (a == '\n') ? '\\n': (a == '\r') ? '\\r': (a == '\t') ? '\\t': "" }) +//from www. j av a 2s.com '"' }