<script type = "text/javaScript">/*** emite cualquier objeto JS como una cadena de formato json* @param {object} _obj: objeto que debe ser emitido como String*/var obj2String = function (_obj) {var t = typeOf (_obj); if (t! = 'objeto' || _obj === null) {// tipo de datos simples if (t == 'string') {_obj = '"' + _obj + '"'; } cadena de retorno (_obj); } else {if (_obj instanciaf date) {return _obj.tolocaleString (); } // matriz o objeto recurse var n, v, json = [], arr = (_obj && _obj.constructor == array); para (n en _obj) {v = _obj [n]; t = typeof (v); if (t == 'string') {v = '"' + v + '"'; } else if (t == "objeto" && v! == null) {v = this.obj2string (v); } json.push ((arr? '': '"' + n + '":') + string (v)); } return (arr? '[': '{') + string (json) + (arr? ']': '}'); }}; var obj = { "result" : { "fs" : { "TSP.IBR.MIRROR" : [{ "_value" : "1.0", "_class" : 4 }], "TSP.IBR.GET_FNAMES" : [{ "_value" : "0.0", "_class" : 4 }], "TSP.IBR.GET_TOKEN_ID" : [{ "_value" : "0.0", "_class" : 4 }], "TSP.IBR.INFO" : [{ "_value" : "0.0", "_class" : 4 }] } }, "isCanceled" : false, "e" : "", "isResponsed" : true, "aoqSize" : 0, "isAsyncPost" : false, "Código": 0, "requid": "xxxx-xxxxxxx-xxxxx-6c2f17bb-ea18-42ec-98fa-3f63b8d26aba-nd-rq", "version": "1.0", "fname": "tsp.ib.get_fnames", "Mensaje": "4 Functions Featcions. "Down", "Nodetime": 1362462128706, "isKeyComessed": falso, "seq": 2} alert (obj2String (obj)) </script>